[ABC329D] 实时唱票冠军 (Election Quick Report)
Score : 350 points Problem Statement There is an election to choose one winner from N candidates with candidate numbers 1, 2, \ldots, N, and there have been M votes cast. Each vote is for exactly one candidate, with the i-th vote being for candidate A_i. The votes will be counted in order from first to last, and after each vote is counted, the current winner will be updated and displayed. The candidate with the most votes among those counted is the winner. If there are multiple candidates with the most votes, the one with the smallest candidate number is the winner. For each i = 1, 2, \ldots, M, determine the winner when counting only the first i votes. Constraints 1 \leq N, M \leq 200000 1 \leq A_i \leq N All input values are integers. Input The input is given from Standard Input in the following format: N M A_1 A_2 \ldots A_M Output Print M lines. The i-th line should contain the winner's candidate number when counting only the first i votes.