# coding: utf-8
import time
def yoselfhuan(x, y):
result = list()
while len(x) >= 1:
for i in range(y + 1):
if i == y:
temp = x.pop(0)
result.append(temp)
print str(temp) + " is out"
else:
print x
x.append(x[0])
x.pop(0)
return result
list1 = []
n = int(input("请输入需要参加的人数:"))
for i in range(n):
if i <= n:
list1.append(i)
print list1
m = int(input("请输入到第几个人出局:"))
sequence = yoselfhuan(list1, m)
print sequence