#include <bits/stdc++.h>
using namespace std;
const long long N = 300005;
char en = '\n';
long long inf = 1e16;
long long mod = 998244353;
long long power(long long x, long long n, long long mod) {
  long long res = 1;
  x %= mod;
  while (n) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
const long long md = 998244353;
inline void add(long long &a, long long b) {
  a += b;
  if (a >= md) a -= md;
}
inline void sub(long long &a, long long b) {
  a -= b;
  if (a < 0) a += md;
}
inline long long mul(long long a) { return a; }
template <typename... T>
inline long long mul(long long a, T... b) {
  return (long long)((long long)a * mul(b...) % md);
}
inline long long mult(long long x, long long y) {
  return (((long long)x) * y) % md;
}
inline long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) x += md;
  return x;
}
inline long long power(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
inline long long inv(long long a) {
  a %= md;
  if (a < 0) a += md;
  long long b = md, u = 0, v = 1;
  while (a) {
    long long t = b / a;
    b -= t * a;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}
long long myPower(long long x, long long n, long long mod) {
  long long res = 1;
  while (n) {
    if (n & 1) res = (res * x) % mod;
    n >>= 1;
    x = (x * x) % mod;
  }
  return res;
}
namespace ntt {
long long base = 1;
vector<long long> roots = {0, 1};
vector<long long> rev = {0, 1};
long long max_base = -1;
long long root = -1;
void init() {
  long long tmp = md - 1;
  max_base = 0;
  while (tmp % 2 == 0) {
    tmp /= 2;
    max_base++;
  }
  root = 2;
  while (true) {
    if (power(root, 1 << max_base) == 1) {
      if (power(root, 1 << (max_base - 1)) != 1) {
        break;
      }
    }
    root++;
  }
}
void ensure_base(long long nbase) {
  if (max_base == -1) {
    init();
  }
  if (nbase <= base) {
    return;
  }
  assert(nbase <= max_base);
  rev.resize(1 << nbase);
  for (long long i = 0; i < (1 << nbase); i++) {
    rev[i] = (rev[i >> 1] >> 1) + ((i & 1) << (nbase - 1));
  }
  roots.resize(1 << nbase);
  while (base < nbase) {
    long long z = power(root, 1 << (max_base - 1 - base));
    for (long long i = 1 << (base - 1); i < (1 << base); i++) {
      roots[i << 1] = roots[i];
      roots[(i << 1) + 1] = mul(roots[i], z);
    }
    base++;
  }
}
void fft(vector<long long> &a) {
  long long n = (long long)a.size();
  assert((n & (n - 1)) == 0);
  long long zeros = __builtin_ctz(n);
  ensure_base(zeros);
  long long shift = base - zeros;
  for (long long i = 0; i < n; i++) {
    if (i < (rev[i] >> shift)) {
      swap(a[i], a[rev[i] >> shift]);
    }
  }
  for (long long k = 1; k < n; k <<= 1) {
    for (long long i = 0; i < n; i += 2 * k) {
      for (long long j = 0; j < k; j++) {
        long long x = a[i + j];
        long long y = mul(a[i + j + k], roots[j + k]);
        a[i + j] = x + y - md;
        if (a[i + j] < 0) a[i + j] += md;
        a[i + j + k] = x - y + md;
        if (a[i + j + k] >= md) a[i + j + k] -= md;
      }
    }
  }
}
vector<long long> multiply(vector<long long> a, vector<long long> b,
                           long long eq = 0) {
  long long need = (long long)a.size() + (long long)b.size() - 1;
  long long nbase = 0;
  while ((1 << nbase) < need) nbase++;
  ensure_base(nbase);
  long long sz = 1 << nbase;
  a.resize(sz);
  b.resize(sz);
  fft(a);
  if (eq)
    b = a;
  else
    fft(b);
  long long inv_sz = inv(sz);
  for (long long i = 0; i < sz; i++) {
    a[i] = mul(mul(a[i], b[i]), inv_sz);
  }
  reverse(a.begin() + 1, a.end());
  fft(a);
  a.resize(need);
  return a;
}
vector<long long> square(vector<long long> a) { return multiply(a, a, 1); }
}  // namespace ntt
long long freq[N];
vector<long long> poly[10];
long long fact[2 * N];
long long ifact[2 * N];
long long pow2[2 * N];
long long nCr(long long n, long long r) {
  if (r > n) return 0;
  return fact[n] * ifact[r] % mod * ifact[n - r] % mod;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  fact[0] = ifact[0] = pow2[0] = 1;
  for (long long i = 1; i < 2 * N; i++) {
    fact[i] = (i * fact[i - 1]) % mod;
    ifact[i] = power(fact[i], mod - 2, mod);
    pow2[i] = (2 * pow2[i - 1]) % mod;
  }
  long long n, k;
  cin >> n >> k;
  memset(freq, 0, sizeof(freq));
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    freq[x]++;
  }
  long long arr[k + 5];
  for (long long i = 1; i <= k; i++) cin >> arr[i];
  for (long long i = 1; i <= k; i++) {
    long long limit = arr[i];
    long long freq1 = 0, freq2 = 0;
    for (long long i = 1; i < limit; i++) {
      if (freq[i] == 1) {
        freq1++;
      } else if (freq[i] > 1)
        freq2++;
    }
    vector<long long> poly1, poly2;
    poly1.resize(freq1 + 1);
    for (long long i = 0; i <= freq1; i++) {
      poly1[i] = nCr(freq1, i) * pow2[i] % mod;
    }
    poly2.resize(2 * freq2 + 1);
    for (long long i = 0; i <= 2 * freq2; i++) {
      poly2[i] = nCr(2 * freq2, i) % mod;
    }
    poly[i] = ntt::multiply(poly1, poly2);
  }
  long long q;
  cin >> q;
  while (q--) {
    long long p;
    cin >> p;
    long long res = 0;
    for (long long i = 1; i <= k; i++) {
      long long req = p - 2 * arr[i];
      if (req <= 0 or req & 1) continue;
      req /= 2;
      req--;
      if (req >= poly[i].size()) continue;
      res += poly[i][req];
      if (res >= mod) res -= mod;
    }
    cout << res << en;
  }
  return 0;
}
