Competitions

# Number of elements in unimodal sequence

Sequence ai is called unimodal if there exists such index p that a1 < a2 < ... < ap and ap > ap+1 > ... > an. For the given value of x find how many times it appears in array.

#### Input

First line contains the size of array n and number of queries q (n, q106). Next line contains n positive integers that represent a unimodal sequence. Each of the next q lines contains value of x. Numbers in array do not exceed 109.

#### Output

For each value of x print in a separate line the number of times it appears in array.

Time limit 2 seconds
Memory limit 128 MiB
Input example #1
6 4
1 5 7 8 5 1
8
1
9
5

Output example #1
1
2
0
2

Input example #2
5 3
10 9 6 3 1
1
2
3

Output example #2
1
0
1

Author Michael Medvediev