#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int nmax = 1005;
long long fac[nmax], finv[nmax], inv[nmax];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < nmax; i++) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = mod - inv[mod % i] * (mod / i) % mod;
    finv[i] = finv[i - 1] * inv[i] % mod;
  }
}
long long com(int n, int k) {
  if (n < k || n < 0 || k < 0) {
    return 0;
  }
  return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main() {
  COMinit();
  long long n, k;
  cin >> n >> k;
  vector<long long> a(k);
  long long sum = 0;
  for (int i = 0; i < k; i++) {
    cin >> a[i];
    sum += a[i];
  }
  vector<long long> c(k + 1);
  for (int i = 0; i < (1 << k); i++) {
    long long mul = 1, cnt = 0;
    for (int j = 0; j < k; j++) {
      if ((i >> j) & 1) {
        cnt++;
        mul *= (com(n - 1, a[j] - 1));
        mul %= mod;
      } else {
        mul *= com(n - 1, a[j]);
      }
    }
    c[cnt] += mul;
  }
  long long ans = 1;
  vector<vector<long long>> dp(n + 1, vector<long long>(sum + 1));
  for (int i = 0; i <= k; i++) {
    dp[0][i] = c[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < sum; j++) {
      for (int l = j; l <= min(j + k, sum); l++) {
        dp[i + 1][l] += (dp[i][j] * c[l - j]) % mod;
        dp[i + 1][l] %= mod;
      }
    }
  }
  cout << dp[n][sum] << endl;
}
