eolymp
bolt
Try our new interface for solving problems
Problems

Karabakh villages

Karabakh villages

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. \InputFile The first line contains two numbers $n~(1 \le n \le 10^5)$ and $q~(1 \le q \le 10^4)$ --- the number of villages in Karabakh and the number of queries respectively. The second line contains $n$ integers $a_i~(0 \le a_i \le 10^9)$ --- the names of the villages. Each of the following $q$ lines contains one integer $x~(0 \le x \le 10^9)$ --- the name of the village, the number of which should be determined. \OutputFile For each query print in a separate line one number --- the number of villages in Karabakh with the given name.
Time limit 1 second
Memory limit 128 MiB
Input example #1
9 4
2 8 1 5 2 8 4 1 8
1
8
3
2
Output example #1
2
3
0
2
Source 2021 Azerbaijan, Republic Informatics Olympiad, Semifinal, March 8