#include <bits/stdc++.h>
using namespace std;

const int mod = 1000000007;
int N, K;
int a[1000];
long c[1001][1001];
long dp[21][1001];
void pre() {
  for (int n = 0; n <= N; ++n) {
    for (int r = 0; r <= n; ++r) {
      if (r == 0) {
        c[n][r] = 1;
      } else {
        c[n][r] = (c[n - 1][r - 1] + c[n - 1][r]) % mod;
      }
    }
  }
}

long comb(int n, int r) {
  if (n < 0 || r < 0) return 0;
  return c[n][r];
}

int main() {
  cin >> N >> K;
  for (int i = 0; i < K; ++i) {
    cin >> a[i];
  }
  
  pre();
  dp[0][0] = 1;
  for (int k = 1; k <= K; ++k) {
    for (int n = 0; n <= N; ++n) {
      long sum = 0;
      for (int x = 0; x <= n; ++x) {
        long add = dp[k - 1][n - x] * comb(N - n + x, x) % mod * comb(N - x, a[k - 1] - x) % mod;
        sum = (sum + add) % mod;
      }
      dp[k][n] = sum;
    }
  }
  cout << dp[K][N] << endl;
}