#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007, MAX = 1005, INF = 1 << 30;
long long inv[MAX], fac[MAX], finv[MAX];
void make() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
    fac[i] = fac[i - 1] * (long long)i % mod;
    finv[i] = finv[i - 1] * inv[i] % mod;
  }
}
long long comb(long long a, long long b) {
  if (a < b) return 0;
  return fac[a] * (finv[b] * finv[a - b] % mod) % mod;
}
long long dp[23][MAX];
int main() {
  std::ifstream in("text.txt");
  std::cin.rdbuf(in.rdbuf());
  cin.tie(0);
  ios::sync_with_stdio(false);
  make();
  int N, K;
  cin >> N >> K;
  vector<int> A(K);
  for (int i = 0; i < K; i++) cin >> A[i];
  dp[0][0] = 1;
  for (int i = 0; i < K; i++) {
    for (int j = 0; j <= N; j++) {
      for (int k = j; k <= N; k++) {
        int d = k - j;
        dp[i + 1][k] += dp[i][j] * comb(N - d, A[i] - d) * comb(N - j, d) % mod;
        dp[i + 1][k] %= mod;
      }
    }
  }
  cout << dp[K][N] << endl;
}
