e-olymp
Competitions

2021 Azerbaijan, Republic Informatics Olympiad, Semifinal, March 8

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.

Input

The first line contains two numbers n (1n105) and q (1q104) - the number of villages in Karabakh and the number of queries respectively.

The second line contains n integers ai (0ai, x109) - 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.

Output

For each query print in a separate line one number - the number of villages in Karabakh with the given name.

Subtasks

This problem consists of 2 subtasks:

SubtaskRestrictionsPoints
0Example0 points
1ai10637 points
2No additional restrictions63 points
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