#include <bits/stdc++.h>
using namespace std;
long long mod(long long a) {
  long long c = a % (long long)(1E9 + 7);
  if (c >= 0) return c;
  return c + (long long)(1E9 + 7);
}
long long inf = (long long)1E16;
long long max(long long a, long long b) {
  if (a < b)
    return b;
  else
    return a;
}
long long min(long long a, long long b) {
  if (a > b)
    return b;
  else
    return a;
}
void Max(long long &pos, long long val) { pos = max(pos, val); }
void Min(long long &pos, long long val) { pos = min(pos, val); }
void Add(long long &pos, long long val) { pos = mod(pos + val); }
long double EPS = 1E-9;
long long kai[20004];
long long kai2[20004];
long long po(long long i, long long p) {
  if (p == 0)
    return 1;
  else {
    i = mod(i);
    if (p == 1) return i;
    if (p % 2 == 0) return po(mod(i * i), p / 2);
    return mod(i * po(i, p - 1));
  }
}
void calc() {
  kai[0] = 1;
  kai2[0] = 1;
  for (long long i = 1; i <= 20004 - 1; i++) {
    kai[i] = mod(kai[i - 1] * i);
  }
  kai2[20004 - 1] = po(kai[20004 - 1], (long long)(1E9 + 7) - 2);
  for (long long i = 20004 - 2; i >= 0; i--) {
    kai2[i] = mod(kai2[i + 1] * (i + 1));
  }
}
long long comb(long long n, long long k) {
  if (n < k) return 0;
  if (n == 0) return 1;
  return mod(mod(kai[n] * kai2[n - k]) * kai2[k]);
}
long long bunbo(long long n) { return po(n, (long long)(1E9 + 7) - 2); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  calc();
  long long n, k;
  cin >> n >> k;
  long long a[k];
  for (long long i = 0; i <= k - 1; i++) cin >> a[i];
  long long dp[k + 1][n + 1];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (long long i = 0; i <= k - 1; i++) {
    for (long long j = 0; j <= n; j++) {
      for (long long p = 0; p <= a[i]; p++) {
        if (j + p <= n) {
          Add(dp[i + 1][j + p],
              mod(dp[i][j] * comb(n - j, p)) * comb(n - p, a[i] - p));
        }
      }
    }
  }
  cout << mod(dp[k][n]) << endl;
  return 0;
}
