#include <bits/stdc++.h>
using namespace std;
const int maxn = 1 << 20;
const int mod = 998244353ll;
int qp(int x, int p) {
  int res = 1;
  while (p) {
    if (p & 1) res = 1ll * res * x % mod;
    x = 1ll * x * x % mod;
    p >>= 1;
  }
  return res % mod;
}
int r = 3, inv_r = qp(r, mod - 2);
void rader(int *a, int len) {
  int j = len >> 1;
  for (int i = 1; i < len - 1; i++) {
    if (i < j) swap(a[i], a[j]);
    int k = len >> 1;
    while (k & j) {
      j ^= k;
      k >>= 1;
    }
    j ^= k;
  }
}
void NTT(int *a, int t, int len) {
  rader(a, len);
  for (int h = 1; h < len; h <<= 1) {
    int wn = qp((t == 1) ? r : inv_r, (mod - 1) / (h * 2));
    int step = h << 1;
    for (int i = 0; i < len; i += step) {
      int e = 1;
      for (int j = i; j < i + h; j++) {
        int u = a[j], v = 1ll * e * a[j + h] % mod;
        a[j] = 1ll * (u + v) % mod;
        a[j + h] = 1ll * (u - v + mod) % mod;
        e = 1ll * e * wn % mod;
      }
    }
  }
  if (t == -1) {
    int inv_len = qp(len, mod - 2);
    for (int i = 0; i < len; i++) a[i] = 1ll * a[i] * inv_len % mod;
  }
}
int cnt[300005];
int A[maxn], B[maxn], fac[300105], inv[300105], ans[maxn];
void init() {
  fac[0] = inv[0] = inv[1] = 1;
  for (int i = 1; i < 300005; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
  for (int i = 1; i < 300005; i++) inv[i] = qp(fac[i], mod - 2);
}
int C(int n, int k) { return 1ll * fac[n] * inv[n - k] % mod * inv[k] % mod; }
int main() {
  init();
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  for (int _ = 1; _ <= k; _++) {
    int x;
    scanf("%d", &x);
    int cnt1 = 0, cnt2 = 0;
    for (int i = 1; i < x; i++) {
      if (cnt[i] == 1) cnt1++;
      if (cnt[i] > 1) cnt2 += 2;
    }
    for (int i = 0; i < maxn; i++) A[i] = B[i] = 0;
    for (int i = 0; i <= cnt1; i++) A[i] = 1ll * C(cnt1, i) * qp(2, i) % mod;
    for (int i = 0; i <= cnt2; i++) B[i] = C(cnt2, i);
    int len = 1;
    while (len < cnt1 + cnt2) len <<= 1;
    len <<= 1;
    NTT(A, 1, len);
    NTT(B, 1, len);
    for (int i = 0; i < len; i++) A[i] = 1ll * A[i] * B[i] % mod;
    NTT(A, -1, len);
    for (int i = 0; i <= cnt1 + cnt2; i++) (ans[i + x + 1] += A[i]) %= mod;
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    int x;
    scanf("%d", &x);
    x >>= 1;
    printf("%d\n", (ans[x] + mod) % mod);
  }
  return 0;
}
