Mode
InterviewTime limit2sMemory limit512 MB
Count how many times each value from 1 to M appears in the sequence and print the largest count.
- Level
Easy1 of 10
- Topics
- Implementation, Array
- Solved
- No attempts yet
Problem
A sequence A1, A2, ..., AN of length N is given. Each term of this sequence is an integer between 1 and M, inclusive.
Define a new sequence B1, B2, ..., BM of length M as follows.
- For each
j(1 ≦ j ≦ M), the value ofBjequals the number of integersi(1 ≦ i ≦ N) such thatAi = j.
Find the maximum value among B1, B2, ..., BM.
Input
The input is given from standard input in the following format.
N M
A1 A2 … AN
Output
Print the maximum value among B1, B2, ..., BM on one line.
Constraints
1 ≦ N ≦ 100.1 ≦ M ≦ 100.1 ≦ Ai ≦ M(1 ≦ i ≦ N).