#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int mod = 1e9 + 7;
int n, m, C[N][N], f[15][N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = C[0][0] = 1; i <= n; ++i)
    for (int j = C[i][0] = 1; j <= i; ++j)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
  f[0][0] = 1;
  for (int i = 1, a; i <= m; ++i) {
    scanf("%d", &a);
    for (int j = 0; j <= n; ++j)
      for (int k = 0; k <= j && k <= a; ++k)
        f[i][j] = (f[i][j] +
                   1ll * f[i - 1][j - k] * C[j][k] % mod * C[n - k][a - k]) %
                  mod;
  }
  printf("%d\n", f[m][n]);
  return 0;
}
