'''
임의의 수의 사람들로 구성된 그룹이 있다고 가정할 때,
이 사람들을 무작위로 여러 팀으로 나누는 프로그램을 작성해보세요.
사용자는 전체 인원 수와 팀당 인원 수를 입력할 수 있어야 하며,
프로그램은 이를 바탕으로 랜덤하게 팀을 구성해야 합니다.
'''
import random,math
total, team_max = map(int,input("전체 인원 수와 팀당 인원 수를 입력해주세요. : ").split(' '))
group_list = [i for i in range(1,total+1)]
random.shuffle(group_list)
i = 0
while len(group_list) >= i:
if len(group_list) >= i+team_max:
print(group_list[i:i+team_max])
i += team_max
continue
else:
print(group_list[i:],"?")
break