def find_i(x, n, k):
    ret = k - 1
    while ret >= 0 and x[ret] == n:
        ret = ret - 1
    return ret

def next(x, i, n, k):
    x[i] += 1
    for j in range(i + 1, k):
        x[j]= 1

n, k = map(int, input().split())

x = [1] * k
print(' '.join(map(str, x)))
ind = find_i(x, n, k)      # find where to increase the sequence
while ind >= 0:            # do while ind is valid, i.e. in [0, k-1]
    next(x, ind, n, k)     # increase the sequence
    print(' '.join(map(str, x)))
    ind = find_i(x, n, k)  # again -- find where to increase the sequence