The capacity of Hong’s pocket is so small that it can only contain \(M\) gifts. Considering the diversity of his gifts, Hong would not buy two of the same kind.

Hong will visit \(N\) shops one by one along the shopping street. There is **ONLY ONE** type of gift sold in each shop. However, he has such a poor memory that he can’t remember how many shops sell gift \(K\). So, he will write a number \(L\) on each gift after buying it, to indicate how many shops selling gift \(K\). In Hong’s opinion, the smaller the number \(L\) is, the better the gift is.

When Hong stops in a shop which sells gift \(K\), there are three situations he might come across.

If there is no gift \(K\) in his pocket and he still has some place for it, he will buy it without hesitation. Before putting it into the pocket, he will write down the number ‘1’ on the gift to indicate that he has only seen one shop selling it.

If there is a gift \(K\) already in his pocket, he will just add L by one, which means that there are \(L + 1\) shops selling gift \(K\).

If there is no gift \(K\) in his pocket and the pocket is full, he would consider that there is no shop selling gift \(K\) (because he cannot remember whether he has met gift \(K\)), so he will have to discard one gift in his pocket to release a place for the gift \(K\). But it will refer to the following rules to determine which gifts to be discarded:

He chooses the gift that has the biggest number \(L\) on it. If several gifts have the same biggest number L, he will discard the one which has been put into the pocket at the earliest time. After discarding the gift, he will put gift \(K\) into his pocket and write number ‘1’ on gift \(K\).

Now, your task is to write a program to record the number of these gifts which have been discarded by Hong.