Confusion
Practice
3 (17 votes)
Easy
Problem
89% Success 6268 Attempts 30 Points 0.2s Time Limit 256MB Memory 1024 KB Max Code

As you know our star "gachn" is rising star in competitive programming but now a days he is upset because of a task given to him by his mentor. His teacher gave him a task : The task is that he has been given a array of N integers . his teacher gave him Q queries to solve.For each query he has to tell the teacher the number of distinct integers from Ai.Ai+1.Ai+2.......AN.

For example N=5 and Q=3.

Input

5 3

1 2 3 2 1

2

1

4

Output :

3

3

2

Constraints :

1<=N,Q<=100000

1<=A[i]<=100000

1<=l<=N

Input

First line will contain 2 integers N ,Q. next line will contain N-space separated integers. next Q lines will contain an integer** L**

Output

For each Q lines output the no.of distinct integers.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
22 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:30
57 votes
Tags:
Ad-HocEasyMathOpen
Points:30
39 votes
Tags:
Basic ProgrammingBit ManipulationImplementationString Manipulation
Editorial

No editorial available for this problem.