n, k = list( map(int, input().split()) )
count = 0
idx = 0
ids = [i for i in range(n)]
while len(ids)>1:
count += 1
if count%k==0 or int(str(count)[-1])==k:
ids.pop(idx)
else:
idx += 1
if idx >= len(ids):
idx = 0
print(ids[0]+1)
网友评论