能一行解决,绝不两行

row,col = map(int,input().split())
matrix = list(map(int,input().split()))
for index,i in enumerate(matrix):
    if (index)%col == 0:
        print(" ".join([str(j) for j in matrix[index:index+col] ]) )