#include <bits/stdc++.h>
using namespace std;
const int N = 12e5 + 5, yzh = 998244353;
int n, k, q, cnt[N], x, ans[N], fac[N], ifac[N];
int A[N], B[N], a, b, L, R[N];
int quick_pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1ll * ans * a % yzh;
    b >>= 1, a = 1ll * a * a % yzh;
  }
  return ans;
}
int C(int n, int m) { return 1ll * fac[n] * ifac[m] % yzh * ifac[n - m] % yzh; }
void NTT(int *A, int o) {
  for (int i = 0; i < n; i++)
    if (i < R[i]) swap(A[i], A[R[i]]);
  for (int i = 1; i < n; i <<= 1) {
    int gn = quick_pow(3, (yzh - 1) / (i << 1)), x, y;
    if (o == -1) gn = quick_pow(gn, yzh - 2);
    for (int j = 0; j < n; j += (i << 1)) {
      int g = 1;
      for (int k = 0; k < i; k++, g = 1ll * g * gn % yzh) {
        x = A[j + k], y = 1ll * g * A[j + k + i] % yzh;
        A[j + k] = (x + y) % yzh;
        A[j + k + i] = (x - y) % yzh;
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  fac[0] = ifac[0] = ifac[1] = 1;
  for (int i = 2; i <= n; i++) ifac[i] = -1ll * yzh / i * ifac[yzh % i] % yzh;
  for (int i = 1; i <= n; i++)
    fac[i] = 1ll * i * fac[i - 1] % yzh,
    ifac[i] = 1ll * ifac[i - 1] * ifac[i] % yzh;
  for (int i = 1; i <= n; i++) scanf("%d", &x), cnt[x]++;
  while (k--) {
    scanf("%d", &x);
    a = b = 0;
    for (int i = 1; i < x; i++)
      if (cnt[i] >= 2)
        a += 2;
      else if (cnt[i] == 1)
        b++;
    memset(A, 0, sizeof(A));
    memset(B, 0, sizeof(B));
    for (int i = 0; i <= a; i++) A[i] = C(a, i);
    for (int i = 0; i <= b; i++) B[i] = 1ll * C(b, i) * quick_pow(2, i) % yzh;
    a += b;
    L = 0;
    for (n = 1; n <= a; n <<= 1) ++L;
    for (int i = 0; i < n; i++) R[i] = (R[i >> 1] >> 1) | ((i & 1) << (L - 1));
    NTT(A, 1), NTT(B, 1);
    for (int i = 0; i < n; i++) A[i] = 1ll * A[i] * B[i] % yzh;
    NTT(A, -1);
    int inv = quick_pow(n, yzh - 2);
    for (int i = 0; i <= a; i++) A[i] = 1ll * A[i] * inv % yzh;
    for (int i = 0; i <= a; i++) (ans[(x + 1 + i) << 1] += A[i]) %= yzh;
  }
  scanf("%d", &q);
  while (q--) scanf("%d", &x), printf("%d\n", (ans[x] + yzh) % yzh);
  return 0;
}
