#include <bits/stdc++.h>
using namespace std;
static const int64_t mod = 1000000007;
int64_t f(int64_t x, int64_t y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return (f(x, y / 2) * f(x, y / 2)) % mod;
  else
    return (x * ((f(x, y / 2) * f(x, y / 2)) % mod)) % mod;
}
int main() {
  int64_t N, K;
  cin >> N >> K;
  vector<int64_t> A(K);
  for (int i = 0; i < K; i++) cin >> A.at(i);
  vector<int64_t> CombN(1 + N);
  CombN[0] = 1;
  for (int i = 1; i <= N; i++)
    CombN[i] = (((CombN[i - 1] * (N + 1 - i)) % mod) * f(i, mod - 2)) % mod;
  vector<vector<int64_t>> dp(1 + K, vector<int64_t>(1 + N, 0));
  dp[0][0] = 1;
  for (int i = 1; i <= K; i++)
    for (int j = 0; j <= N; j++) {
      int64_t Min;
      if (j <= A[i - 1])
        Min = j;
      else
        Min = A[i - 1];
      vector<int64_t> C(1 + Min);
      C[0] = 1;
      vector<int64_t> D(1 + Min);
      D[0] = CombN[N - A[i - 1]];
      for (int64_t k = 1; k <= Min; k++)
        C[k] = (((C[k - 1] * (N + k - j)) % mod) * f(k, mod - 2)) % mod;
      for (int64_t k = 1; k <= Min; k++)
        D[k] =
            (((D[k - 1] * (A[i - 1] - k + 1)) % mod) * f(N + 1 - k, mod - 2)) %
            mod;
      int64_t sum = 0;
      for (int64_t l = 0; l <= Min; l++) {
        int64_t a = (C[l] * D[l]) % mod;
        a = (a * dp[i - 1][j - l]) % mod;
        sum = (sum + a) % mod;
      }
      dp[i][j] = sum;
    }
  cout << dp[K][N] << endl;
  return 0;
}
