Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EI20213Q3B - Index of numbers (2)

You are given n integers and m queries. For each query, you are given a number p, you should output the number of distinct values that each of them occurs at least p times in given integers.

Input

  • The first line contains two integers n, m (1 ≤ n, m ≤ 105).

  • The second line contains n integers (-109 ≤ ai ≤ 109).

  • The third line contains m integers representing m queries 1 ≤ pj ≤ n).

Output

For each query, output the number of distinct values that occurs at least p times.

Sample

 

Input

Output

7 3

0 3 5 6 9 3 5

3 1 2

0 5 2


Added by:Ha Minh Ngoc
Date:2021-07-10
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.