#include <bits/stdc++.h>
using namespace std;
const int N = 4001, mod = 998244353;
int qpow(int a, int b, int ans = 1) {
  for (; b; (b & 1) && (ans = (long long)ans * a % mod), b >>= 1,
            a = (long long)a * a % mod)
    ;
  return ans;
}
int add(int a, int b) {
  a += b;
  return a >= mod ? a - mod : a;
}
int ntt(int a[], int L, int fl) {
  static int rev[N];
  int l = 0;
  while ((1 << l) < L) l++;
  for (int i = (0); i <= (L - 1); ++i) {
    rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << l - 1);
    if (i < rev[i]) swap(a[i], a[rev[i]]);
  }
  for (int i = 1; i < L; i <<= 1) {
    int w, x, y, wn = qpow(3, (mod - 1) / (i * 2));
    if (fl == -1) wn = qpow(wn, mod - 2);
    for (int j = 0; j < L; j += i << 1) {
      w = 1;
      for (int k = (0); k <= (i - 1); ++k) {
        x = a[j + k], y = (long long)a[j + k + i] * w % mod;
        a[j + k] = add(x, y);
        a[j + k + i] = add(x, mod - y);
        w = (long long)w * wn % mod;
      }
    }
  }
  if (fl == -1) {
    l = qpow(L, mod - 2);
    for (int i = (0); i <= (L - 1); ++i) a[i] = (long long)a[i] * l % mod;
  }
  return 0;
}
int n, k, c[N], dp[N][N];
int jc[N], ijc[N];
int a[N], b[N];
int main() {
  scanf("%d%d", &n, &k);
  jc[0] = 1, ijc[0] = 1;
  for (int i = (1); i <= (k); ++i) {
    scanf("%d", c + i);
  }
  for (int i = (1); i <= (n); ++i)
    jc[i] = (long long)jc[i - 1] * i % mod, ijc[i] = qpow(jc[i], mod - 2);
  dp[0][0] = 1;
  for (int i = 1; i <= k; i++) {
    int L = 1;
    while (L <= n + c[i]) L <<= 1;
    for (int i = (0); i <= (L - 1); ++i) a[i] = b[i] = 0;
    for (int j = (0); j <= (n); ++j)
      a[j] = (long long)dp[i - 1][j] * ijc[j] % mod;
    for (int j = (0); j <= (c[i]); ++j)
      b[j] = (long long)jc[n - j] * ijc[c[i] - j] % mod * ijc[j] % mod;
    ntt(a, L, 1), ntt(b, L, 1);
    for (int i = (0); i <= (L - 1); ++i) a[i] = (long long)a[i] * b[i] % mod;
    ntt(a, L, -1);
    for (int j = (0); j <= (n); ++j)
      dp[i][j] = (long long)a[j] * jc[j] % mod * ijc[n - c[i]] % mod;
  }
  printf("%d", dp[k][n]);
}
