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.
/**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main
{
    static FastReader scan;
    static PrintWriter pw;
    static long MOD = 1_000_000_007;
    static long INF = 1_000_000_000_000_000_000L;
    static long inf = 2_000_000_000;
    public static void main(String[] args) {
        new Thread(null,null,"BaZ",1<<25)
        {
            public void run()
            {
                try
                {
                    solve();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static int n,m,q,BIT[];
    static void solve() throws IOException
    {
        scan = new FastReader();
        pw = new PrintWriter(System.out,true);
        StringBuilder fast = new StringBuilder();
        n = ni(); m = ni(); q = ni();
        Pair freqs[] = new Pair[m];
        int freq[] = new int[m+1];
        for(int i=0;i<n;++i) {
            ++freq[ni()];
        }
        for(int i=0;i<m;++i) {
            freqs[i] = new Pair(freq[i+1], i+1);
        }
        Arrays.sort(freqs);
      //  pa("freqs", freqs);
        long pref[] = new long[m];
        long ntimes[] = new long[m];
        for(int i=0;i<m;++i) {
            if(i>0 && ntimes[i-1]>=INF) {
                ntimes[i] = ntimes[i-1];
            }
            else {
                if(i+1<m) {
                    ntimes[i] = 1L * (i+1) * (freqs[i+1].x - freqs[i].x);
                }
                else {
                    ntimes[i] = INF;
                }
            }
        }
        for(int i=0;i<m;++i) {
            if(i==0) {
                pref[i] = n+ntimes[i];
            }
            else if(pref[i-1]<INF) {
                pref[i] = ntimes[i] + pref[i-1];
            }
            else {
                pref[i] = pref[i-1];
            }
        }
//        pa("ntimes", ntimes);
//        pa("pref", pref);
        Query queries[] = new Query[q];
        for(int i=0;i<q;++i)  {
            long k = nl();
            int low = 0, high = m-1, mid,ans = m-1;
            while(low<=high) {
                mid = (low+high)>>1;
                if(pref[mid]>=k) {
                    ans = mid;
                    high = --mid;
                }
                else {
                    low = ++mid;
                }
            }
           // pl("Query "+i+" lies in "+ans+" block");
            queries[i] = new Query(i,ans, k);
        }
        Arrays.sort(queries);
        BIT = new int[m+1];
        int ptr = -1;
        int ans[] = new int[q];
        for(int i=0;i<q;++i) {
            while(ptr+1<m && ptr+1<=queries[i].which_block) {
                ptr++;
                update(freqs[ptr].y, 1);
            }
//            pl("Handling query: "+queries[i]);
//            pl("ptr"+ptr);
            long ispe = queries[i].k - (ptr==0 ? n : pref[ptr-1]);
           // pl("ispe: "+ispe);
            int pos = (int)(ispe%(1+ptr));
            if(pos==0) {
                pos = (1+ptr);
            }
            //pl("pos: "+pos);
            ans[queries[i].org_index] = find_first(pos);
        }
        for(int e : ans) {
            fast.append(e);
            fast.append("\n");
        }
        psb(fast);
        pw.flush();
        pw.close();
    }
    static void update(int index,int val)
    {
        for(int i=index;i<=m;i+=i&-i)
            BIT[i]+=val;
    }
    static int query(int index)
    {
        int sum = 0;
        for(int i=index;i>0;i-=i&-i)
            sum+=BIT[i];
        return sum;
    }
    static int find_first(int req) {
        int low = 0, high = m, mid, ans = m;
        while(low<=high) {
            mid = (low+high)>>1;
            if(query(mid)>=req) {
                ans = mid;
                high = --mid;
            }
            else {
                low = ++mid;
            }
        }
        return ans;
    }
    static class Query implements Comparable<Query> {
        int org_index, which_block;
        long k;
        Query(int org_index, int which_block, long k) {
            this.org_index = org_index;
            this.which_block = which_block;
            this.k = k;
        }
        public int compareTo(Query other) {
            return this.which_block - other.which_block;
        }
        public String toString() {
            return "{" + org_index + ", " + which_block + "," + k + "}";
        }
    }
    static class Pair implements Comparable<Pair>
    {
        int x,y;
        Pair(int x,int y)
        {
            this.x=x;
            this.y=y;
        }
        public int compareTo(Pair other)
        {
            if(this.x!=other.x)
                return this.x-other.x;
            return this.y-other.y;
        }
        public String toString()
        {
            return "("+x+","+y+")";
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static class FastReader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public FastReader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public FastReader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000000];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = (c == '-');
            if (neg) c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
            if (neg) return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) return;
            din.close();
        }
    }
}