n children are standing in a circle and playing the counting-out game. Children are numbered clockwise from 1 to n. In the beginning, the first child is considered the leader. The game is played in k steps. In the i-th step the leader counts out a_{i} people in clockwise order, starting from the next person. The last one to be pointed at by the leader is eliminated, and the next player after him becomes the new leader.

For example, if there are children with numbers [8, 10, 13, 14, 16] currently in the circle, the leader is child 13 and a_{i} = 12, then counting-out rhyme ends on child 16, who is eliminated. Child 8 becomes the leader.

You have to write a program which prints the number of the child to be eliminated on every step.


-----Input-----

The first line contains two integer numbers n and k (2 ≤ n ≤ 100, 1 ≤ k ≤ n - 1).

The next line contains k integer numbers a_1, a_2, ..., a_{k} (1 ≤ a_{i} ≤ 10^9).


-----Output-----

Print k numbers, the i-th one corresponds to the number of child to be eliminated at the i-th step.


-----Examples-----
Input
7 5
10 4 11 4 1

Output
4 2 5 6 1 

Input
3 2
2 5

Output
3 2 



-----Note-----

Let's consider first example:   In the first step child 4 is eliminated, child 5 becomes the leader.  In the second step child 2 is eliminated, child 3 becomes the leader.  In the third step child 5 is eliminated, child 6 becomes the leader.  In the fourth step child 6 is eliminated, child 7 becomes the leader.  In the final step child 1 is eliminated, child 3 becomes the leader.

Difficulty: interview

Starter code:

Solutions:
n, k = map(int, input().split())
aa = [int(x) for x in input().split()]

nxt = [(i + 1) % n for i in range(n)]
prv = [(i - 1 + n) % n for i in range(n)]

cur = 0
for z in range(k):
    a = aa[z]
    a %= n
    for i in range(a):
        cur = nxt[cur]
    nxt[prv[cur]] = nxt[cur]
    prv[nxt[cur]] = prv[cur]
    print(cur + 1, end=' ')
    cur = nxt[cur]
    n -= 1


3
import sys

n, k = list(map(int, sys.stdin.readline().split()))
a = [int(x) for x in sys.stdin.readline().split()]

l = [i for i in range(1, n + 1)]
p = 0

ret = []

for d in a:
    p += d
    p %= len(l)
    ret.append(l[p])
    del l[p]
    
print(' '.join(str(x) for x in ret))


n, k = map(int, input().split())
data = map(int, input().split())
arr = [i+1 for i in range(n)]
for v in data:
  l = len(arr)
  i = v % l
  print(arr[i], end = " ")
  arr = [arr[(i+k) % l] for k in range(1,l)]
print()  

n, k = list(map(int, input().split()))
*a, = list(map(int, input().split()))
ans = []
peo = list(range(1, n+1))

cur = 0
for i in range(k):
    dind = (cur+a[i])%len(peo)
    cur = dind
    ans.append(peo.pop(dind))
    cur %= len(peo)
    dind %= len(peo)
print(*ans)


n, k = map(int, input().strip().split(" "))
arr = list(map(int, input().strip().split()))
children = list([i + 1 for i in range(n)])
answer = []
i = 0
for ai in arr:
    i = (i + ai) % n
    answer.append(str(children[i]))
    del children[i]
    n -= 1

print(" ".join(answer))

n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
c = list(range(1, n + 1))
ved = 0
for i in a:
    n = i % len(c)
    ved = ved + n
    if (ved >= len(c)):
        ved -= len(c)
    print(c[ved], end=" ")
    c.pop(ved)
    
    
    
    


n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
children = list(range(1, n + 1))

pos = 0
for i in range(k):
	pos = (pos + a[i]) % len(children)
	print(children[pos], end = ' ')
	del children[pos]
print()

n, k = map(int, input().split())
a = list(map(int, input().split()))
cur = 0
x = []
for i in range(n):
    x.append(i + 1)
for i in range(k):
    v = cur
    f = a[i] % n
    for j in range(f):
        v += 1
        if v >= n:
            v = v - n
    
    print(x[v], end=' ')
    x.pop(v)
    n -= 1
    cur = v % n

    
    

n, _ = [int(i) for i in input().strip().split(' ')]
ak = [int(i) for i in input().strip().split(' ')]


people = list(range(1, n + 1))
current = 0

leaved = []

for k in ak:
    pos = ((current + k) % len(people))
    leave = people.pop(pos)

    leaved.append(leave)

    if pos >= len(people):
        current = 0
    else:
        current = pos

print(" ".join(map(str, leaved)))


n,k=map(int,input().split())
*a,=map(int,input().split())
g=list(range(n+1))[1:]
n-=1
v=0
for i in a:
    v+=i
    v%=len(g)
    print(g.pop(v),end=' ')


n, k = map(int, input().split())
a = list(map(int, input().split()))
array = [0] * n
for i in range (n):
    array[i] = i + 1
now = 0
for i in range (k):
    dp = (now + a[i] % len(array)) % len(array)
    print(array[dp], end = " ")
    array.pop(dp)
    now = dp
    

n, k = map(int, input().split())
a = list(map(int, input().split()))

def round(children, a, leader):
    lead_pos = children.index(leader)
    a = (lead_pos + a) % len(children)
    deleted = children[a]
    del(children[a])
    return children, a % len(children), deleted

children = list(range(1, n+1))
result = []
leader = 1

for i in range(k):
    children, leader_pos, deleted = round(children, a[i], leader)
    leader = children[leader_pos]
    result.append(deleted)

print(*result, sep=' ')


from copy import deepcopy as dcopy
def main():
    n, k = list(map(int, input().split()))
    ks = list(map(int, input().split()))

    children = list(range(n))
    leader_i = 0
    res = []
    for k in ks:
        elim_i = (leader_i + k) % len(children)
        elim_num = dcopy(children[elim_i])
        nextl_i = (leader_i + k + 1) % len(children)
        nextl_num = dcopy(children[nextl_i])
        res.append(children.pop(elim_i)+1)
        leader_i = children.index(nextl_num)

    print(' '.join(map(str,res)))

def __starting_point():
    main()

__starting_point()

n, k = [int(x) for x in str(input()).split(' ', 1)]
next_ = [i+1 for i in range(n+1)]
next_[n] = 1
a = [int(x) for x in str(input()).split(' ')]
remain = n
cur = 1
prev = None
eli = []
for a0 in a:
    a0 = a0 % remain
    for _ in range(a0):
        prev = cur
        # print("{}->{}".format(cur, next_[cur]))
        cur = next_[cur]
    if prev is None:
        prev = cur
        while next_[prev] != cur:
            prev = next_[prev]
    # print("====")
    eli.append(cur)
    next_[prev] = next_[cur]
    cur = next_[cur]
    remain -= 1
print(' '.join([str(e) for e in eli]))


from collections import deque

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

q = deque(list(range(1, N+1)))
ret = []

for k in range(K):
    for a in range(A[k]%len(q)):
        q.append(q.popleft())
    ret.append(q.popleft())

print(' '.join([str(r)for r in ret]))
    
    




n, k = map(int, input().split())
a = list(map(int, input().split()))
used = [0] * n
ans = ""
cnt = 1
tmp = n
for i in range(k):
    cur = a[i] % n
    while cur > 0:
        if used[cnt] == 0:
            cur -= 1
        cnt += 1
        cnt = cnt % tmp
    if cnt != 0:
        ans += str(cnt) + " "
    else:
        ans += str(tmp) + " "
    used[cnt - 1] = 1
    while used[cnt] == 1:
        cnt += 1
        cnt %= tmp
    cnt += 1
    cnt %= tmp
    n -= 1
print(ans)

n, k = map(int, input().split())
a = map(int, input().split())

cs = list(range(1, n+1))
l = 0
res = ""
len = n

for x in a:
    pos = (l + x) % len
    #print(cs, pos)
    res += str(cs[pos]) + " "
    del cs[pos]
    len -= 1
    l = pos

print(res)

n,k = list(map(int,input().split()))
a = [int(x) for x in input().split()]
v = [i for i in range(1,n+1)]
val = 0
ans = ""
for i in a:
	i %= len(v)
	val += i
	if val>=len(v): val -= len(v)
	ans += str(v[val]) + ' '
	del v[val]
	
print(ans)


from collections import deque
n,k=list(map(int,input().split()))
a=[int(i) for i in input().split()]
d=deque([i for i in range(1,n+1)])
res=[]
for i in range(k):
    d.rotate(-(a[i]))
    x=d.popleft()
    res.append(x)
print(*res)


import sys

def solve():
    n, k = map(int, input().split())
    ch = [i + 1 for i in range(n)]
    a = [int(i) for i in input().split()]

    live = n
    leader = 0
    ans = []

    for v in a:
        v = v % live
        j = 0
        cnt = 0

        while cnt < v:
            if ch[(leader + j + 1) % n]:
                cnt += 1

            j += 1

        ans.append((leader + j) % n + 1)
        ch[(leader + j) % n] = 0
        live -= 1
        leader = (leader + j + 1) % n

        while ch[leader] == 0:
            leader = (leader + 1) % n

        # print(ch)
        # print(leader + 1)

    print(*ans)

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def __starting_point():
    solve()
__starting_point()

def plus(a):
    nonlocal n
    a += 1
    a = a % n
    return a

n, k = map(int, input().split())
a = list(map(int, input().split()))
p = [1]*n
qwer = n
index = 0
for i in range(k):
    res = 0
    while res != a[i]%qwer:
        index = plus(index)
        res += p[index]
    p[index] = 0
    qwer -= 1
    print(index + 1, end = " ")
    while p[index] != 1 :
        index = plus(index)


n,k=map(int,input().split())
l=list(map(int,input().split()))
j=0
L=list(range(1,n+1))
for i in l:
    k-=1
    j=(j+i)%n
    if k!=0:
        print(L[j],end=' ')
    else :print (L[j],end='')
    n-=1
    
    L.pop(j)