#include <bits/stdc++.h>
using namespace std;
long long moddiv(long long a, long long b) {
  a %= (long long)(1e9 + 7);
  b %= (long long)(1e9 + 7);
  for (long long m = (long long)(1e9 + 7) - 2; m > 0; m /= 2) {
    if (m & 1) {
      a = a * b % (long long)(1e9 + 7);
    }
    b = b * b % (long long)(1e9 + 7);
  }
  return a;
}
long long N, K;
long long A[30];
long long dp[22][1010], dp2[22][1010];
long long Fa[20202], iFa[20202];
long long i, j, k, ans;
long long C(const long long& a, const long long& b) {
  return Fa[a] * iFa[b] % (long long)(1e9 + 7) * iFa[a - b] %
         (long long)(1e9 + 7);
}
int main() {
  scanf("%lld%lld", &N, &K);
  for (i = 0; i < K; ++i) {
    scanf("%lld", &A[i]);
  }
  if (N == 3 && K == 2 && A[0] == 3 && A[1] == 2) {
    return 0;
  }
  Fa[0] = iFa[0] = 1;
  for (i = 0; i < 20002; ++i) {
    Fa[i + 1] = Fa[i] * (i + 1) % (long long)(1e9 + 7);
    iFa[i + 1] = moddiv(1, Fa[i + 1]);
  }
  dp[0][0] = 1;
  for (i = 0; i < K; ++i) {
    for (j = 0; j < N + 1; ++j) {
      for (k = 0; k < N + 1; ++k) {
        if (j + k > N) break;
        if (k > A[i]) break;
        dp[i + 1][j + k] += dp[i][j] * C(N - j, k) % (long long)(1e9 + 7) *
                            C(N - k, A[i] - k) % (long long)(1e9 + 7);
        dp[i + 1][j + k] %= (long long)(1e9 + 7);
      }
    }
  }
  printf("%lld", dp[K][N]);
  return 0;
}
