import itertools;x,y=map(int,raw_input().split(' ')) for z in itertools.product(range(1,x+1),repeat=y):print ' '.join(map(str,z))