#include <stdio.h>
int main() {
    int a, b,count=0;
    scanf("%d %d", &a, &b);
    while(~scanf("%d",&a)){
        printf("%d ",a);
        if(++count%b==0)
        printf("\n");
    }
    return 0;
}