#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
std::vector<int> p;
int phi(int n) {
  int result = n;
  for (auto i : p) {
    if (i * i > n) break;
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      result -= result / i;
    }
  }
  if (n > 1) result -= result / n;
  return result;
}
int pow2(int k, int n) {
  if (n == 0) return 1;
  if (n == 1) return k;
  int x = pow2(k, n / 2);
  return x * x * pow2(k, n % 2);
}
void del(int n, std::vector<int>& del) {
  if (n == 1) {
    del.push_back(1);
    return;
  }
  std::vector<int> razl;
  int curn = n;
  for (auto pr : p) {
    while (curn % pr == 0) {
      razl.push_back(pr);
      curn /= pr;
    }
  }
  if (curn > 1) razl.push_back(curn);
  std::vector<int> un;
  un.push_back(razl[0]);
  map<int, int> deg;
  for (auto pr : razl) deg[pr]++;
  for (int i = 1; i < razl.size(); i++) {
    if (razl[i] != razl[i - 1]) un.push_back(razl[i]);
  }
  while (un.size() < 7) un.push_back(1);
  std::vector<int> degs;
  for (int i = 0; i < 7; i++) degs.push_back(deg[un[i]]);
  for (int i0 = 0; i0 < degs[0] + 1; i0++)
    for (int i1 = 0; i1 < degs[1] + 1; i1++)
      for (int i2 = 0; i2 < degs[2] + 1; i2++)
        for (int i3 = 0; i3 < degs[3] + 1; i3++)
          for (int i4 = 0; i4 < degs[4] + 1; i4++)
            for (int i5 = 0; i5 < degs[5] + 1; i5++)
              for (int i6 = 0; i6 < degs[6] + 1; i6++) {
                int d = pow2(un[0], i0) * pow2(un[1], i1) * pow2(un[2], i2) *
                        pow2(un[3], i3) * pow2(un[4], i4) * pow2(un[5], i5) *
                        pow2(un[6], i6);
                del.push_back(d);
              }
}
long long gcd(long long a, long long b, long long& x, long long& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
int main() {
  std::vector<bool> isp(1001, false);
  std::vector<int> mindiv(1001);
  for (int i = 2; i <= 1000; i++) {
    int sq = (int)sqrt((double)i + 1);
    bool f = false;
    for (int j = 0; j < p.size(); j++) {
      if (p[j] > sq) continue;
      if (i % p[j] == 0) {
        f = true;
        mindiv[i] = p[j];
        break;
      }
    }
    if (f) continue;
    p.push_back(i);
    isp[i] = true;
    mindiv[i] = i;
  }
  std::vector<int> num(1000001, 0);
  std::vector<long long> cnk(1000001, 0);
  std::vector<long long> inv(1000001, 0);
  std::vector<int> phin(1000001, 0);
  int n, m, k, q;
  long long ans = 0;
  std::vector<int> lol;
  scanf("%d %d %d", &n, &k, &q);
  std::vector<int> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    std::vector<int> dels;
    del(a[i], dels);
    for (auto x : dels) {
      if (phin[x] == 0) phin[x] = phi(x);
      num[x]++;
      if (num[x] == k) {
        cnk[x] = 1;
        ans = (ans + phin[x]) % mod;
      }
      if (num[x] > k) {
        long long old = cnk[x];
        int u = num[x] - 1;
        cnk[x] = (cnk[x] * (u + 1)) % mod;
        if (inv[u - k + 1] == 0) {
          long long xx, yy;
          gcd(u - k + 1, mod, xx, yy);
          inv[u - k + 1] = (xx + mod * mod) % mod;
        }
        cnk[x] = (cnk[x] * (inv[u - k + 1])) % mod;
        ans = (ans + phin[x] * (cnk[x] - old + mod)) % mod;
      }
    }
  }
  std::vector<int> qu(q);
  for (int i = 0; i < q; i++) {
    scanf("%d", &qu[i]);
    std::vector<int> dels;
    del(qu[i], dels);
    for (auto x : dels) {
      if (phin[x] == 0) phin[x] = phi(x);
      num[x]++;
      if (num[x] == k) {
        cnk[x] = 1;
        ans = (ans + phin[x]) % mod;
      }
      if (num[x] > k) {
        long long old = cnk[x];
        int u = num[x] - 1;
        cnk[x] = (cnk[x] * (u + 1)) % mod;
        if (inv[u - k + 1] == 0) {
          long long xx, yy;
          gcd(u - k + 1, mod, xx, yy);
          inv[u - k + 1] = (xx + mod * mod) % mod;
        }
        cnk[x] = (cnk[x] * (inv[u - k + 1])) % mod;
        ans = (ans + phin[x] * (cnk[x] - old + mod)) % mod;
      }
    }
    printf("%d\n", (int)ans);
  }
}
