#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += mod;
}
int mult(int a, int b) { return (long long)a * b % mod; }
int powmod(int a, int pw) {
  int res = 1;
  while (pw > 0) {
    if (pw & 1) res = mult(res, a);
    a = mult(a, a);
    pw >>= 1;
  }
  return res;
}
const int bound = (int)4e5;
bool calc = false;
vector<int> fact, inv, invfact;
int C(int from, int what) {
  if (what < 0 || what > from) return 0;
  return mult(fact[from], mult(invfact[what], invfact[from - what]));
}
vector<int> factor(int n) {
  vector<int> res;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) {
      res.push_back(i);
      while (n % i == 0) n /= i;
    }
  if (n > 1) res.push_back(n);
  return res;
}
void solve(int n) {
  if (!calc) {
    calc = true;
    fact.assign(bound, 1);
    invfact.assign(bound, 1);
    inv.assign(bound, 1);
    for (int i = 1; i < bound; i++) fact[i] = mult(fact[i - 1], i);
    for (int i = 2; i < bound; i++) {
      int cur = mult(inv[mod % i], mod / i);
      cur = mod - cur;
      assert(mult(cur, i) == 1);
      inv[i] = cur;
      invfact[i] = mult(inv[i], invfact[i - 1]);
      assert(mult(invfact[i], fact[i]) == 1);
    }
  }
  int k, q;
  cin >> k >> q;
  vector<int> a(n), c(q);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < q; i++) cin >> c[i];
  const int bnd = max(*max_element((c).begin(), (c).end()),
                      *max_element((a).begin(), (a).end())) +
                  1;
  vector<vector<int> > divs(bnd);
  vector<vector<int> > primes(bnd);
  for (int i = 1; i < bnd; i++)
    for (int j = i; j < bnd; j += i) divs[j].push_back(i);
  for (int i = 1; i < bnd; i++) primes[i] = factor(i);
  vector<int> cnt_div(bnd);
  for (int x : a)
    for (int y : divs[x]) cnt_div[y]++;
  vector<int> strange_f(bnd);
  for (int i = 1; i < bnd; i++) {
    const int Dv = (int)(primes[i]).size();
    for (int mask = 0; mask < (1 << Dv); mask++) {
      int par = __builtin_popcount(mask) % 2;
      int cur = i;
      for (int j = 0; j < Dv; j++)
        if ((mask >> j) & 1) cur /= primes[i][j];
      if (!par)
        add(strange_f[i], cur);
      else
        sub(strange_f[i], cur);
    }
  }
  int ans = 0;
  for (int i = 1; i < bnd; i++) {
    add(ans, mult(strange_f[i], C(cnt_div[i], k)));
  }
  for (int x : c) {
    for (int i : divs[x]) {
      sub(ans, mult(strange_f[i], C(cnt_div[i], k)));
      cnt_div[i]++;
      add(ans, mult(strange_f[i], C(cnt_div[i], k)));
    }
    cout << ans << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  while (cin >> n) solve(n);
}
