#include <bits/stdc++.h>
using namespace std;
long long inv[200010];
long long factorial[200010];
long long inv_factorial[200010];
void GetInv() {
  for (int i = 1; i < 200010; i++) {
    if (i == 1)
      inv[i] = 1;
    else {
      inv[i] =
          (1000000007 - (1000000007 / i) * inv[1000000007 % i]) % 1000000007;
      if (inv[i] < 0) inv[i] += 1000000007;
    }
  }
}
void GetFactorial() {
  factorial[0] = 1;
  inv_factorial[0] = 1;
  for (int i = 1; i < 200010; i++) {
    factorial[i] = factorial[i - 1] * i;
    factorial[i] %= 1000000007;
    inv_factorial[i] = inv_factorial[i - 1] * inv[i];
    inv_factorial[i] %= 1000000007;
  }
}
long long combination(int n, int r) {
  if (n < 0 || r < 0 || n < r) return 0;
  long long ret = factorial[n] * inv_factorial[r];
  ret %= 1000000007;
  ret *= inv_factorial[n - r];
  return ret % 1000000007;
}
long long modpow(int n, int r) {
  long long ret = 1;
  long long tmp = (long long)n;
  while (r != 0) {
    if (r % 2) ret *= tmp;
    tmp *= tmp;
    tmp %= 1000000007;
    ret %= 1000000007;
    r /= 2;
  }
  return ret;
}
long long dp[21][1010];
int main() {
  GetInv();
  GetFactorial();
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < k; i++) cin >> a[i];
  dp[0][n] = 1;
  for (int i = 0; i < k; i++) {
    for (int j = 0; j <= n; j++) {
      for (int k = 0; k <= j; k++) {
        dp[i + 1][j - k] += dp[i][j] * combination(n - k, a[i] - k) %
                            1000000007 * inv_factorial[k] % 1000000007;
        dp[i + 1][j - k] %= 1000000007;
      }
    }
  }
  cout << dp[k][0] * factorial[n] % 1000000007 << "\n";
  return 0;
}
