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.