Less Than X


Problem Statement

You are given a list xx of nn integers x=[x1,x2,...,xn]x = [x_1, x_2, ..., x_n]. You are also given qq queries, for each query, you are give some integer kk should output the number of unique integers less than kk in xx.

Input Format

Your first line will contain nn and qq. Your next line will contain nn space-separated integers x1,x2,...,xnx_1, x_2, ..., x_n. Your next qq lines will contain one integer each.

Output Format

For each query, you should output an integer representing the number of UNIQUE (non-duplicate) numbers (strictly) less than it in xx.

Constraints

  • 1n,q1051 \leq n, q \leq 10^5
  • 109xi109-10^9 \leq x_i \leq 10^9

Sample Cases

Input 1
10 3
1 4 4 5 6 -2 4 2 5 10
14
5
7
Output 1
7
4
6
Explanation 1

There are 7 integers less than 14, being 2,1,2,4,5,6,10-2, 1, 2, 4, 5, 6, 10. There are 4 integers less than 5, being 2,1,2,4-2, 1, 2, 4. There are 6 integers less than 7, being 2,1,2,4,5,6-2, 1, 2, 4, 5, 6.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.