Help Kumar

0

0 votes
Problem

Mr. Kumar is very passionate about competitive programming. He is participating in a programming contest in HackerEarth and came across an interesting problem .He found it very easy and implemented within few minutes but couldn't get it accepted . He has already debugged his code for like hours but no luck. He has become very frustated and now he asks for your help . Please help poor Kumar with the problem as he is left with very little time . Here goes the problem.

You are given a pile of n (1<=n<=100000) objects represented by numbers 1,2,3..n with 1 being on top and n on the bottom . From this pile of objects, a particular object is selected and moved to the top of the pile , preserving the order of rest of the objects. Before moving it to top you have to answer how many objects are lying above this selected object . This procedure is repeated m (1<=m<=100000) times.


Input

First line of input contains integer n (number of objects) and m ( number of times above specified procedure is repeated). Each of m lines contains an integer x , representing the object which has to be moved(1<=x<=n) .

Output

For each of the operation , output the required answer with newline.

Constraints

1<=n,m<=100000

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?