#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long mod = 1000000007;
long long inv[10000100];
long long FactorialInv[10000100];
long long Factorial[10000100];
long long beki(long long a, long long b) {
  a %= mod;
  if (b == 0) {
    return 1;
  }
  long long ans = beki(a, b / 2);
  ans = ans * ans % mod;
  if (b % 2 == 1) {
    ans = ans * a % mod;
  }
  return ans;
}
void init_combination() {
  const int MAX = 10000002;
  Factorial[0] = 1;
  inv[0] = 1;
  for (int i = 1; i <= MAX; i++) {
    Factorial[i] = Factorial[i - 1] * i % mod;
  }
  FactorialInv[MAX] = beki(Factorial[MAX], mod - 2);
  for (long long i = MAX - 1; i >= 0; i--) {
    FactorialInv[i] = FactorialInv[i + 1] * (i + 1) % mod;
  }
  for (int i = 1; i <= MAX; i++) {
    inv[i] = FactorialInv[i] * Factorial[i - 1] % mod;
  }
}
long long combination(long long a, long long b) {
  if ((a == b) || (b == 0)) {
    return 1;
  }
  if (a < b) return 0;
  long long ans = Factorial[a] * FactorialInv[b] % mod;
  ans = ans * FactorialInv[a - b] % mod;
  return ans;
}
long long N, K;
vector<long long> a;
vector<vector<long long>> dp;
int main() {
  init_combination();
  cin >> N >> K;
  a.resize(K);
  for (int i = 0; i < K; i++) cin >> a[i];
  dp.resize(K + 1);
  dp[0].resize(N + 1);
  dp[0][0] = 1;
  for (int i = 0; i < K; i++) {
    dp[i + 1].resize(N + 1);
    for (long long before = 0; before <= N; before++) {
      for (long long delta = 0; delta <= a[i]; delta++) {
        if (before + delta > N) break;
        long long factor =
            dp[i][before] * combination(N - delta, a[i] - delta) % mod;
        factor *= beki(combination(N, a[i]), mod - 2);
        factor %= mod;
        factor *= combination(N - before, delta);
        factor %= mod;
        dp[i + 1][before + delta] += factor;
        dp[i + 1][before + delta] %= mod;
      }
    }
  }
  long long ans = dp[K][N];
  for (int i = 0; i < K; i++) {
    ans *= combination(N, a[i]);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
