import sys N, M = map(int, input().split(' ')) ans = [] def dfs(flag): if len(ans) == M: print(" ".join(map(str, ans))) return for i in range(flag, N+1): ans.append(i) dfs(i) ans.pop() dfs(1)