2021 Azerbaijan, Republic Informatics Olympiad, Semifinal, March 8
There are many villages in Karabakh. Some villages have the same name. For example, you can find many villages called "Abdurrahmanli". You are given a list of the names of the villages of Karabakh and then you should answer some queries. Each query contains the name of one village. Determine the number of villages in Karabakh with this name.
For simplicity, the names of the villages have been replaced with numbers.
The first line contains two numbers n (1 ≤ n ≤
105) and q (1 ≤ q ≤
104) - the number of villages in Karabakh and the number of queries respectively.
The second line contains n integers
ai (0 ≤
ai, x ≤
109) - the names of the villages. Each of the following q lines contains one integer x - the name of the village, the number of which should be determined.
For each query print in a separate line one number - the number of villages in Karabakh with the given name.
This problem consists of 2 subtasks:
|2||No additional restrictions||63 points|
9 4 2 8 1 5 2 8 4 1 8 1 8 3 2
2 3 0 2