#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int n2, n, m, a[1200007], rev[1200007], fac[1200007], inv2, inv[1200007], po,
    f[1200007], g[1200007], c[1200007], ans[1200007], u, v, Q;
int C(int m, int n) {
  return m < n ? 0 : 1ll * fac[m] * inv[m - n] % mod * inv[n] % mod;
}
int pow(int a, int b) {
  int v = 1;
  while (b) {
    if (b & 1) v = 1ll * v * a % mod;
    a = 1ll * a * a % mod;
    b >>= 1;
  }
  return v;
}
void NTT(int *a, int it, int op) {
  for (register int i = 0; i < it; i++) {
    if (i < rev[i]) swap(a[i], a[rev[i]]);
  }
  for (int i = 1; i < it; i <<= 1) {
    int w1 = pow(op == 1 ? 3 : 332748118, (mod - 1) / (i << 1));
    for (int j = 0; j < it; j += (i << 1)) {
      int t1, t2, w = 1;
      for (int k = 0; k < i; ++k, w = 1ll * w1 * w % mod) {
        t1 = a[j + k], t2 = 1ll * w * a[j + k + i] % mod;
        a[j + k] = (t1 + t2) % mod, a[j + k + i] = (t1 - t2 + mod) % mod;
      }
    }
  }
  if (!op) {
    int inv = pow(it, mod - 2);
    for (register int i = 0; i <= it; i++) {
      a[i] = 1ll * a[i] * inv % mod;
    }
  }
}
inline void conv(int cnt, int *f, int *g, int *c) {
  static int tmpf[1200007], tmpg[1200007];
  for (register int i = 0; i < cnt; i++) tmpf[i] = f[i], tmpg[i] = g[i];
  long long lim = log2(cnt) - 1;
  for (register int i = 0; i < cnt; i++) {
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << lim);
  }
  NTT(tmpf, cnt, 1);
  NTT(tmpg, cnt, 1);
  for (register int i = 0; i < cnt; i++) {
    c[i] = 1ll * tmpf[i] * tmpg[i] % mod;
    tmpf[i] = tmpg[i] = 0;
  }
  NTT(c, cnt, 0);
}
int main() {
  int x;
  scanf("%d%d", &n, &m);
  for (register int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  fac[0] = inv[0] = 1;
  n2 = n << 1;
  po = 1;
  while (po <= n2) po <<= 1;
  for (register int i = 1; i < n2; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
  inv[n2 - 1] = pow(fac[n2 - 1], mod - 2);
  for (register int i = n2 - 2; i >= 0; i--) {
    inv[i] = 1ll * inv[i + 1] * (i + 1) % mod;
  }
  for (register int i = 1; i <= m; i++) {
    scanf("%d", &x);
    u = v = 0;
    for (register int j = 1; j < x; j++) {
      if (a[j] == 1)
        u++;
      else if (a[j] >= 2)
        v++;
    }
    for (register int j = 0; j < po; j++) {
      f[j] = 1ll * C(u, j) * pow(2, j) % mod;
      g[j] = C(2 * v, j);
    }
    conv(po, f, g, c);
    for (register int j = 0; j <= n; j++) {
      ans[j + x + 1] = (ans[j + x + 1] + c[j]) % mod;
    }
  }
  scanf("%d", &Q);
  while (Q--) {
    scanf("%d", &x);
    printf("%d\n", ans[x >> 1]);
  }
}
