Misha was interested in water delivery from childhood. That's why his mother sent him to the annual Innovative Olympiad in Irrigation (IOI). Pupils from all Berland compete there demonstrating their skills in watering. It is extremely expensive to host such an olympiad, so after the first n olympiads the organizers introduced the following rule of the host city selection.

The host cities of the olympiads are selected in the following way. There are m cities in Berland wishing to host the olympiad, they are numbered from 1 to m. The host city of each next olympiad is determined as the city that hosted the olympiad the smallest number of times before. If there are several such cities, the city with the smallest index is selected among them.

Misha's mother is interested where the olympiad will be held in some specific years. The only information she knows is the above selection rule and the host cities of the first n olympiads. Help her and if you succeed, she will ask Misha to avoid flooding your house.

Input

The first line contains three integers n, m and q (1 ≤ n, m, q ≤ 500 000) — the number of olympiads before the rule was introduced, the number of cities in Berland wishing to host the olympiad, and the number of years Misha's mother is interested in, respectively.

The next line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ m), where a_i denotes the city which hosted the olympiad in the i-th year. Note that before the rule was introduced the host city was chosen arbitrarily.

Each of the next q lines contains an integer k_i (n + 1 ≤ k_i ≤ 10^{18}) — the year number Misha's mother is interested in host city in.

Output

Print q integers. The i-th of them should be the city the olympiad will be hosted in the year k_i.

Examples

Input


6 4 10
3 1 1 1 2 2
7
8
9
10
11
12
13
14
15
16


Output


4
3
4
2
3
4
1
2
3
4


Input


4 5 4
4 4 5 1
15
9
13
6


Output


5
3
3
3

Note

In the first example Misha's mother is interested in the first 10 years after the rule was introduced. The host cities these years are 4, 3, 4, 2, 3, 4, 1, 2, 3, 4.

In the second example the host cities after the new city is introduced are 2, 3, 1, 2, 3, 5, 1, 2, 3, 4, 5, 1.
#!/usr/bin/env python
from __future__ import division, print_function
 
import operator as op
import os
import sys
from bisect import bisect_left, bisect_right, insort
from io import BytesIO, IOBase
from itertools import chain, repeat, starmap
 
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
else:
    from functools import reduce
 
 
def main():
    n, m, q = map(int, input().split())
    a = [int(x) for x in input().split()]
 
    counter = [0] * m
    for ai in a:
        counter[ai - 1] += 1
 
    count_order = sorted(range(m), key=lambda x: counter[x])
    years = [0] * m
    for i in range(m - 1):
        diff = counter[count_order[i + 1]] - counter[count_order[i]]
        years[i + 1] = years[i] + diff * (i + 1)
 
    max_k = max(counter) * m - sum(counter)
    k = [int(input()) - n for _ in range(q)]
    k_order = sorted(range(q), key=lambda x: k[x])
 
    sortedlist = SortedList()
    res, idx = [0] * q, 0
 
    for i in range(q):
        ki = k[k_order[i]]
        if ki > max_k:
            res[k_order[i]] = ((ki - max_k - 1) % m) + 1
        else:
            while years[idx] < ki:
                sortedlist.append(count_order[idx])
                idx += 1
            ki -= years[idx - 1] + 1
            ki %= idx
            res[k_order[i]] = sortedlist[ki] + 1
 
    print(*res, sep='\n')
 
 
BS = 200
class SortedList:
    def __init__(self, data = []):
        data = sorted(data)
        self.chunks = [data[i:i + BS] for i in range(0,len(data),BS)]
        self.chunks0 = [chunk[0] for chunk in self.chunks]
        self.sizes = [len(chunk) for chunk in self.chunks]
        self.size = sum(self.sizes)
        self.fen = []
        self._rebuild = True

##### _append and _remove
    def append(self, val):
        self.size += 1
        if self.size - 1:
            i,j = self._upper_bound(val)
            chunk = self.chunks[i]
            chunk.insert(j, val)
            self.chunks0[i] = chunk[0]
            self.sizes[i] += 1
            self._update(i, 1)
            
            if self.sizes[i] >= 2 * BS:
                self.chunks.insert(i + 1, chunk[BS:])
                self.chunks0.insert(i + 1, chunk[BS])
                self.sizes.insert(i + 1, self.sizes[i] - BS)
                self.sizes[i] = BS
                del chunk[BS:]
                self._rebuild = True
        else:
            self.chunks.append([val])
            self.chunks0.append(val)
            self.sizes.append(1)
            self._rebuild = True
                
    def _remove(self, i, j):
        del self.chunks[i][j]
        self.sizes[i] -= 1
        self.size -= 1
        self._update(i, -1)

        if not self.sizes[i]:
            del self.chunks[i]
            del self.chunks0[i]
            del self.sizes[i]
            self._rebuild = True
        else:
            self.chunks0[i] = self.chunks[i][0]
##### _append and _remove


##### _upper and _lower bounds    
    def _upper_bound(self, val):
        if not self.size:
            return 0,0
        #i = bisect.bisect_right(self.chunks0, val, 1) - 1
        #j = bisect.bisect_right(self.chunks[i], val)
        #return i,j

        chunks = self.chunks
        chunks0 = self.chunks0

        i, hi = 0, len(chunks)
        while i + 1 < hi:
            mid = (i + hi) >> 1
            if val < chunks0[mid]:
                hi = mid
            else:
                i = mid

        chunk = chunks[i]
        lo, j = -1, len(chunk)
        while lo + 1 < j:
            mid = (lo + j) >> 1
            if val < chunk[mid]:
                j = mid
            else:
                lo = mid
        return i, j
    
    
    def _lower_bound(self, val):
        if not self.size:
            return 0,0
        #i = bisect.bisect_left(self.chunks0, val, 1) - 1
        #if i and val <= self.chunks[i - 1][-1]: i -= 1 
        #j = bisect.bisect_left(self.chunks[i], val)
        #return i,j
        
        chunks = self.chunks
        chunk0 = self.chunk0
        
        i, hi = -1, len(chunks) - 1
        while i + 1 < hi:
            mid = (i + hi) >> 1
            if val <= chunks0[mid]:
                hi = mid
            else:
                i = mi

        if i and val <= chunks[i - 1][-1]: 
            i -= 1 
        
        chunk = self.chunks[i]
        lo, j = -1, len(chunk)
        while lo + 1 < j:
            mid = (lo + j) >> 1
            if val <= chunk[mid]:
                j = mid
            else:
                lo = mid
        return i, j
    
##### END _upper and _lower bounds        


##### FENWICK
    def _build(self):
        self._rebuild = False
        self.fen[:] = self.sizes
        fen = self.fen
        numb_chunks = self.numb_chunks = len(fen)
        for i in range(numb_chunks):
            if i | i + 1 < numb_chunks:
                fen[i | i + 1] += fen[i]

    def _update(self, i, val):
        fen = self.fen
        if not self._rebuild:
            numb_chunks = self.numb_chunks
            while i < numb_chunks:
                fen[i] += val
                i |= i + 1

    def _query(self, r):
        if self._rebuild:
            self._build()
        fen = self.fen
        val = 0
        while r:
            val += fen[r - 1]
            r &= r - 1
        return val

    def _findkth(self, k):
        """Find largest r such that sum(sizes[:r]) <= k"""
        if k < self.sizes[0]:
            return 0, k
        if k >= self.size - self.sizes[-1]:
            return len(self.sizes) - 1, k - self.size + self.sizes[-1]
        
        if self._rebuild:
            self._build()
        fen = self.fen
        numb_chunks = self.numb_chunks
        r = -1
        for d in reversed(range(numb_chunks.bit_length())):
            r2 = r + (1 << d)
            if r2 < numb_chunks and k >= fen[r2]:
                r = r2
                k -= fen[r]
        return r + 1, k
##### END FENWICK


# Wrappers
    def discard(self, val):
        if self.chunks:
            i,j = self._upper_bound(val)
            if j and self.chunks[i][j - 1] == val:
                self._remove(i, j - 1)
    
    def remove(self, val):
        before = self.size
        self.discard(val)
        if before == self.size:
            assert(KeyError)
    
    def __delitem__(self, idx):
        if idx < 0:
            idx = self.size - idx
        self._remove(*self._findkth(idx))

    def __getitem__(self, idx):
        if idx < 0:
            idx = self.size - idx
        i, j = self._findkth(idx)
        return self.chunks[i][j]
    
    def pop(self, idx = -1):
        del self[idx]

    def upper_bound(self, val):
        i,j = self._upper_bound(val)
        return self.query(i) + j

    def lower_bound(self, val):
        i,j = self._lower_bound(val)
        return self._query(i) + j

    def __contains__(self, val):
        if self.chunks:
            i,j = self._lower_bound(val)
            if j < len(self.chunks[i]) and self.chunks[i][j] == val:
                return True
        return False

    def count(self, val):
        return self.upper_bound(val) - self.lower_bound(val)
    
    def clear(self):
        self.chunks = []
        self.chunks0 = []
        self.sizes = []
        self.size = 0
        self.rebuild = True

    def copy(self):
        return sortedlist(self)

    import itertools
    def __iter__(self): return self.itertools.chain(*self.chunks)
    def __len__(self): return self.size
    def __repr__(self): return '[' + ', '.join(str(x) for x in self) + ']'

 
 
# region fastio
 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()
 
 
if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
 
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# endregion
 
if __name__ == "__main__":
    main()