Less Than X
Problem Statement
You are given a list x of n integers x=[x1,x2,...,xn]. You are also given q queries, for each query, you are give some integer k should output the number of unique integers less than k in x.
Input Format
Your first line will contain n and q. Your next line will contain n space-separated integers x1,x2,...,xn. Your next q 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 x.
Constraints
- 1≤n,q≤105
- −109≤xi≤109
Sample Cases
10 3
1 4 4 5 6 -2 4 2 5 10
14
5
7
7
4
6
Explanation 1
There are 7 integers less than 14, being −2,1,2,4,5,6,10. There are 4 integers less than 5, being −2,1,2,4. There are 6 integers less than 7, being −2,1,2,4,5,6.
Comments0
No comments yet
Be the first to comment.
New comment
Log in to join the discussion.