n2 = int(input().split(' ')[1]) l1 = input().split(' ') l2 = [l1[i:i+n2] for i in range(0,len(l1),n2)] print(' '.join([' '.join(j) for j in l2[::-1]]))