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.
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool setmin(T& a, T b) {
  if (a > b) return a = b, 1;
  return 0;
}
template <class T>
inline bool setmax(T& a, T b) {
  if (a < b) return a = b, 1;
  return 0;
}
template <class T>
inline T fast(T a, T b, T mod) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
template <class T>
inline T russian(T a, T b, T mod) {
  long long res = 0;
  while (b) {
    if (b & 1) res = (res + a) % mod;
    a = (a + a) % mod;
    b >>= 1;
  }
  return res;
}
template <class T>
inline T sub(T a, T b, T mod) {
  return ((a - b) + mod) % mod;
}
template <class T>
istream& operator>>(istream& os, vector<T>& container) {
  for (auto& u : container) os >> u;
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& container) {
  for (auto& u : container) os << u << " ";
  return os;
}
template <typename T>
inline T gcd(T a, T b) {
  while (b) swap(a %= b, b);
  return a;
}
long double e = 2.7182818284590452353602874713526624;
long double PI = acos(-1);
long double eps = 1e-11;
const long long T = 1 << 19;
const long long INF = 1e9 + 7;
const long long BIG_INF = 1e18 + 5;
const long long N = 1e6 + 7;
const long long M = 2007;
long long n, m, k;
using namespace std;
struct Node {
  int Klucz;
  int Lewy_dist, Prawy_dist;
  Node *Lewy_id, *Prawy_id, *Gora_id, *Dol_id;
  Node(int klucz, int lewy_dist, int prawy_dist)
      : Klucz(klucz),
        Lewy_dist(lewy_dist),
        Prawy_dist(prawy_dist),
        Lewy_id(nullptr),
        Prawy_id(nullptr),
        Gora_id(nullptr),
        Dol_id(nullptr) {}
};
struct Skiplist {
 private:
  int Rozmiar;
  Node *Szczyt_lewej_kolumny, *Szczyt_prawej_kolumny;

 public:
  void insert(int x) { Dodaj(x); }
  void insert_no_duplicates(int x) {
    if (!this->count(x)) Dodaj(x);
  }
  void erase(int x) {
    if (this->count(x)) Usun(x);
  }
  void erase_all(int x) {
    while (this->count(x)) Usun(x);
  }
  int count(int x) {
    Node* pom = this->Find(x);
    int ret = 0;
    while (pom->Klucz == x) {
      ret++;
      pom = pom->Prawy_id;
    }
    return ret;
  }
  int at(int x) { return this->At(x)->Klucz; }
  int position_of(int x) { return Position_of(x); }
  int size() { return Rozmiar; }
  void list() { Wypisz2(); }
  Skiplist()
      : Rozmiar(0),
        Szczyt_lewej_kolumny(new Node(-1000000007, 0, 1)),
        Szczyt_prawej_kolumny(new Node(1000000007, 1, 0)) {
    srand(time(0));
    Szczyt_lewej_kolumny->Prawy_id = Szczyt_prawej_kolumny;
    Szczyt_prawej_kolumny->Lewy_id = Szczyt_lewej_kolumny;
  }
  ~Skiplist() {
    while (Rozmiar > 0) Usun(At(0)->Klucz);
    delete Szczyt_lewej_kolumny;
    delete Szczyt_prawej_kolumny;
  }

 private:
  void dodaj_poziom() {
    clog << "Dodaje poziom " << endl;
    Szczyt_lewej_kolumny->Gora_id =
        new Node(-1000000007, 0, Szczyt_lewej_kolumny->Prawy_dist);
    Szczyt_lewej_kolumny->Gora_id->Dol_id = Szczyt_lewej_kolumny;
    Szczyt_lewej_kolumny = Szczyt_lewej_kolumny->Gora_id;
    Szczyt_prawej_kolumny->Gora_id =
        new Node(1000000007, Szczyt_prawej_kolumny->Lewy_dist, 0);
    Szczyt_prawej_kolumny->Gora_id->Dol_id = Szczyt_prawej_kolumny;
    Szczyt_prawej_kolumny = Szczyt_prawej_kolumny->Gora_id;
    Szczyt_prawej_kolumny->Lewy_id = Szczyt_lewej_kolumny;
    Szczyt_lewej_kolumny->Prawy_id = Szczyt_prawej_kolumny;
  }
  void usun_poziom() {
    clog << "Usuwam poziom" << endl;
    Szczyt_lewej_kolumny = Szczyt_lewej_kolumny->Dol_id;
    Szczyt_prawej_kolumny = Szczyt_prawej_kolumny->Dol_id;
    delete Szczyt_prawej_kolumny->Gora_id;
    delete Szczyt_lewej_kolumny->Gora_id;
  }
  void Dodaj(int klucz) {
    if (klucz <= -1000000007 || klucz >= 1000000007) {
      cerr << "Wartość spoza zakresu (-INF, INF)";
      return;
    }
    Node* Lewy = Find(klucz);
    Node* Prawy = Lewy->Prawy_id;
    Node* nowy = new Node(klucz, 1, 1);
    nowy->Lewy_id = Lewy;
    nowy->Prawy_id = Prawy;
    Lewy->Prawy_id = nowy;
    Prawy->Lewy_id = nowy;
    if (Prawy == Szczyt_prawej_kolumny && Lewy == Szczyt_lewej_kolumny)
      dodaj_poziom();
    Node* ostatni = nowy;
    int ile_w_lewo = 1;
    while (rand() & 1) {
      while (!Lewy->Gora_id) {
        ile_w_lewo += Lewy->Lewy_dist;
        Lewy = Lewy->Lewy_id;
      }
      Lewy = Lewy->Gora_id;
      Prawy = Lewy->Prawy_id;
      if (Prawy == Szczyt_prawej_kolumny && Lewy == Szczyt_lewej_kolumny)
        dodaj_poziom();
      int ile_w_prawo = Lewy->Prawy_dist - ile_w_lewo + 1;
      Lewy->Prawy_dist = ile_w_lewo;
      Prawy->Lewy_dist = ile_w_prawo;
      Node* nowy2 = new Node(klucz, ile_w_lewo, ile_w_prawo);
      Lewy->Prawy_id = nowy2;
      nowy2->Lewy_id = Lewy;
      Prawy->Lewy_id = nowy2;
      nowy2->Prawy_id = Prawy;
      nowy2->Dol_id = nowy;
      nowy->Gora_id = nowy2;
      nowy = nowy2;
      ostatni = nowy;
    }
    usun_do_gory(ostatni, -1);
    Rozmiar++;
  }
  Node* Find(int klucz) {
    Node* temp = Szczyt_lewej_kolumny;
    while (true) {
      while (klucz >= temp->Prawy_id->Klucz) temp = temp->Prawy_id;
      if (!temp->Dol_id) return temp;
      temp = temp->Dol_id;
    }
  }
  void Usun(int klucz) {
    Node* usuwany = Find(klucz);
    if (usuwany->Klucz != klucz) return;
    Rozmiar--;
    while (usuwany->Gora_id) usuwany = usuwany->Gora_id;
    usun_do_gory(usuwany, 1);
    while (usuwany->Dol_id) {
      if (usuwany->Prawy_id == Szczyt_prawej_kolumny->Dol_id &&
          usuwany->Lewy_id == Szczyt_lewej_kolumny->Dol_id)
        usun_poziom();
      usuwany = usuwany->Dol_id;
      usun_v(usuwany->Gora_id);
    }
    if (usuwany->Prawy_id == Szczyt_prawej_kolumny->Dol_id &&
        usuwany->Lewy_id == Szczyt_lewej_kolumny->Dol_id)
      usun_poziom();
    usun_v(usuwany);
  }
  void usun_v(Node* usuwany) {
    int pom1 = usuwany->Prawy_id->Lewy_dist - 1;
    int pom2 = usuwany->Lewy_id->Prawy_dist - 1;
    usuwany->Lewy_id->Prawy_dist += pom1;
    usuwany->Prawy_id->Lewy_dist += pom2;
    usuwany->Prawy_id->Lewy_id = usuwany->Lewy_id;
    usuwany->Lewy_id->Prawy_id = usuwany->Prawy_id;
    delete usuwany;
  }
  void usun_do_gory(Node* LewyNad, int val) {
    while (LewyNad != Szczyt_lewej_kolumny) {
      while (!LewyNad->Gora_id) LewyNad = LewyNad->Lewy_id;
      LewyNad = LewyNad->Gora_id;
      LewyNad->Prawy_dist -= val;
      LewyNad->Prawy_id->Lewy_dist -= val;
    }
  }
  void Wypisz() {
    Node* pom = Szczyt_lewej_kolumny;
    cout << "wartosc  :  ";
    while (pom->Dol_id) pom = pom->Dol_id;
    while (pom->Prawy_id->Prawy_id) {
      pom = pom->Prawy_id;
      cout << pom->Klucz << ' ';
    }
    cout << endl;
    pom = Szczyt_lewej_kolumny;
    cout << "wysokosc :  ";
    while (pom->Dol_id) pom = pom->Dol_id;
    while (pom->Prawy_id->Prawy_id) {
      pom = pom->Prawy_id;
      int high = 0;
      Node* pom2 = pom;
      while (pom2->Gora_id) {
        high++;
        pom2 = pom2->Gora_id;
      }
      cout << high << ' ';
    }
    cout << endl;
  }
  void Wypisz2() {
    Node* pom = Szczyt_lewej_kolumny;
    while (pom->Dol_id) pom = pom->Dol_id;
    while (pom->Prawy_id->Prawy_id) {
      pom = pom->Prawy_id;
      cout << pom->Klucz << ' ';
    }
  }
  Node* At(int poz) {
    if (poz >= Rozmiar || poz < 0)
      throw(invalid_argument("Brak szukanego indeksu"));
    Node* temp = Szczyt_lewej_kolumny;
    poz++;
    while (true) {
      while (temp->Prawy_id && poz >= temp->Prawy_dist) {
        poz -= temp->Prawy_dist;
        temp = temp->Prawy_id;
      }
      if (!temp->Dol_id) return temp;
      temp = temp->Dol_id;
    }
  }
  int Position_of(int klucz) {
    Node* pom = Szczyt_lewej_kolumny;
    int poz = -1;
    while (true) {
      while (pom->Prawy_id->Klucz <= klucz) {
        poz += pom->Prawy_dist;
        pom = pom->Prawy_id;
      }
      if (!pom->Dol_id) return poz;
      pom = pom->Dol_id;
    }
  }
};
long long ile[N];
long long odp[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  Skiplist s;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    ile[temp]++;
  }
  vector<pair<int, int> > tab;
  for (int i = 1; i <= m; i++) {
    tab.push_back({ile[i], i});
  }
  vector<pair<long long, int> > zap;
  for (int i = 0; i < k; i++) {
    long long temp;
    cin >> temp;
    temp -= n;
    zap.push_back({temp, i});
  }
  sort((zap).begin(), (zap).end());
  sort((tab).begin(), (tab).end());
  long long czas = 0;
  long long wys = 0;
  long long id = 0;
  for (int i = 0; i < k; i++) {
    long long pom = zap[i].first;
    long long nr = zap[i].second;
    long long diff = pom - czas;
    while (id != m) {
      long long next = tab[id].first - wys;
      if ((int)(s).size() * next < diff) {
        wys += next;
        diff -= (int)(s).size() * next;
        czas += (int)(s).size() * next;
        s.insert(tab[id++].second);
      } else
        break;
    }
    long long poz = (diff - 1) % (int)(s).size();
    odp[nr] = s.at(poz);
  }
  for (int i = 0; i < k; i++) cout << odp[i] << '\n';
  return 0;
}
