#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
struct Comb {
  vector<vector<ll>> c;
  Comb(int n) : c(n + 1, vector<ll>(n + 1)) {
    for (int i = 0; i <= n; i++) c[i][0] = c[i][i] = 1;
    for (int i = 2; i <= n; i++) {
      for (int j = 1; j < i; j++)
        c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
    }
  }
  ll operator()(int i, int j) { return c[i][j]; }
} comb(1000);
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(k);
  for (int i = 0; i < k; i++) cin >> a[i];
  vector<vector<ll>> dp(k + 1, vector<ll>(n + 1));
  dp[0][0] = 1;
  for (int i = 0; i < k; i++) {
    for (int j = 0; j <= n; j++) {
      vector<ll> sum(n + 2);
      for (int k = 0; k <= j; k++) {
        sum[k + 1] = (sum[k] + dp[i][k] * comb(n - k, j - k));
      }
      for (int k = 0; k <= j; k++) {
        if (a[i] - k < 0 || a[i] - k > n - j) continue;
        ll r = comb(n - j, a[i] - k);
        ll c = 0;
        for (int l = j - k; l <= j; l++) {
          c += dp[i][l] * comb(n - l, j - l) % MOD * comb(l, j - k) % MOD;
        }
        c %= MOD;
        dp[i + 1][j] += r * c % MOD;
      }
      dp[i + 1][j] %= MOD;
    }
  }
  cout << dp[k][n] << endl;
  return 0;
}
