#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
const int mod = 1e9 + 7;
int dp[22][maxn];
int C[maxn][maxn];
void init() {
  for (int i = 0; i < maxn; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
  }
}
int main() {
  init();
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  int tot = 0;
  for (int i = 1; i <= k; i++) cin >> a[i], tot += a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= k; i++)
    for (int j = 0; j <= n; j++)
      for (int l = 0; l <= a[i] && j + l <= n; l++)
        dp[i][j + l] = (dp[i][j + l] + 1LL * dp[i - 1][j] * C[n - j][l] % mod *
                                           C[n - l][a[i] - l] % mod) %
                       mod;
  cout << dp[k][n] << '\n';
}
