Aloyna is a can lover girl and whenever she goes to a shop, she must buy a can to drink. This time she goes to a shop to buy a can. There are
$n$ cans in the shop of
$k$ types. The types are numbered from
She will buy a specific type of can if the quantity of this type of can is the maximum in the shop. Can you find which type of can Aloyna will buy?
In the first line, there will be 2 integers
$1 \le n \le 1000$) and
$1 \le k \le 100$).
In the next line, there will be n integers,
$1 \le a_i \le k$), the types of each can in the shop.
Print a number, the type number of the can which Aloyna will buy from the shop. If there are multiple answers then choose the can whose type number is minimum.
6 3 1 2 2 2 1 3
There are 6 cans of 3 types and type #1’s quantity is 2, type #2’s quantity is 3 and type #3’s quantiy is 1. Since type #2’s quantity is the maximum, so the answer is 2.
3 3 1 2 3
Since every type’s quantity is the same, so the answer is the can whose type number is minimum which is 1 in this case.
Login to submit
Just count the occurrences of every type and print the max occurring one.