Description InputOutputSample Input3 4 1 2 2 1 2 1 3 1 2 1 1 1 3 1 3 2 3 2 3 Sample Output2 2 1 1 3 2 2 1Hint N=100000,M=1000000SourceBy wangyisong1996加强数据