下面展示一些 内联代码片
。
// A code block
n, m = map(int, raw_input().split())
number = range(1, n+1)
length = n
index = 0
count = 1
pop_count = 0
while pop_count != n-1:
# if index == length:
# number.reverse()
# index = 0
if count % m == 0:
number.pop(index)
pop_count += 1
length -= 1
count += 1
else:
index = (index + 1) % length
count += 1
print number[0]