import java.util.ArrayList;
import java.util.Scanner; public class Text { @SuppressWarnings("resource")
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int M = scanner.nextInt();//M代表输入的M串字符串
int N=scanner.nextInt();//N代表输出的每串字符串的位数
ArrayList<String> arrayList = new ArrayList<String>();
ArrayList<String> arrayList1 = new ArrayList<String>();
String[] arr=new String[M] ;
String a=scanner.next();
arr=a.split(",");
for (int i = 0; i < arr.length; i++) {
arrayList.add(arr[i]);
}
for (int i = 0; i < arrayList.size(); i++) {
if (arrayList.get(i).length() < N) {
String temp0="" ;
for (int j = 0; j < N - arrayList.get(i).length(); j++) {
temp0 = temp0 + "0";
}
arrayList1.add(arrayList.get(i) + temp0);
}
if (arrayList.get(i).length() >N) {
String temp=arrayList.get(i);
int t=(int) Math.ceil((double)temp.length()/N);
for (int j = 0; j < t; j++) {
if (j==t-1) {
if ((temp.substring(N*j)).length()<N) {
String temp1 = "";
for (int s = 0; s < N - (temp.substring(N*j)).length(); s++) {
temp1 = temp1 + "0";
}
arrayList1.add(temp.substring(N*j)+temp1);
}else { arrayList1.add(temp.substring(N*j));
}
}else {
arrayList1.add(temp.substring(N*j, N*(j+1)));
} }
}
} for (String string : arrayList1) {
System.out.print(string+" ");
}
} }