from itertools import combinations
num_list = list(map(int, input().split()))
N=num_list[0]
M = num_list[1]
num_list =[]
for i in range(1,N+1):
num_list.append(i)
total_list= list(combinations(num_list,M))
for tmp in total_list:
result_string = ""
for i in range(len(tmp)):
result_string+=str(tmp[i])+" "
print(result_string)
조합을 물어보는 문제여서 combination 씀
itertool을 안쓸 경우 combination 구현 필요