Mexor#11529

Mexor

2 seconds
256 megabytes
Hard

You are given an array consisting of non-negative integers and queries. Each query is characterized by one number and consists of the following consecutive steps:

Note that after each query the array changes.

Input

The first line contains two positive integers and (1 \le n, m \le 3 \cdot 10^5) — the number of elements in the array and the number of queries.

The next line contains non-negative integer numbers a_i (0 \le a_i \le 3 \cdot 10^5) — the elements of the array.

Each of the next lines contains a query — one non-negative integer number (0 \le x \le 3 \cdot 10^5).

Output

For each query, print the answer on a separate line.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading

Note

Mex of a sequence of numbers is the minimum non-negative number that is not present in the sequence as an element. For example, mex([4, 33, 0, 1, 1, 5]) = 2 and mex([1, 2, 3]) = 0.