import sys
input = sys.stdin.readline
from itertools import combinations_with_replacement
n,m = map(int,input().split())
for i in combinations_with_replacement(range(1,n+1),m):
print(' '.join(map(str,i)))
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
arr = []
def perm():
if len(arr) == m:
print(' '.join(map(str,arr)))
return
for i in range(1,n+1):
if len(arr) > 0:
if i < max(arr):
continue
arr.append(i)
perm()
arr.pop()
perm()
from itertools import combinations
combinations_with_replacement(arr,m)
중복조합이다