#include <bits/stdc++.h>
using namespace std;
const long long p = (1e9 + 7);
long long po(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  if (b == 1) {
    return a;
  }
  if (b % 2 == 0) {
    long long u = po(a, b / 2);
    return (u * u) % p;
  }
  long long u = po(a, b - 1);
  return (a * u) % p;
}
long long inv(long long x) { return po(x, p - 2); }
long long fact[2001];
long long invf[2001];
long long c(long long n, long long k) {
  return fact[n] * ((invf[k] * invf[n - k]) % p) % p;
}
long long invc(long long n, long long k) {
  return (invf[n] * ((fact[k] * fact[n - k]) % p)) % p;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  fact[0] = 1;
  invf[0] = 1;
  for (long long i = 1; i <= 2000; ++i) {
    fact[i] = fact[i - 1] * i;
    fact[i] %= p;
    invf[i] = inv(fact[i]);
  }
  long long n, k;
  cin >> n >> k;
  long long a[k];
  for (long long i = 0; i < k; ++i) {
    cin >> a[i];
  }
  long long dp[n + 1][k + 1];
  for (long long i = 0; i <= n; ++i) {
    dp[i][k] = 0;
  }
  for (long long i = 0; i <= k; ++i) {
    dp[n][i] = 1;
  }
  for (long long i = (n - 1); i >= 0; i--) {
    for (long long j = (k - 1); j >= 0; j--) {
      long long z = a[j];
      long long u = 1;
      long long ans = 0;
      for (long long t = 0; t <= (n - i); ++t) {
        long long h = ((c(n - i, t) * u) % p) * c(n - t, z - t);
        h %= p;
        u %= p;
        u *= (z - t);
        ans += (dp[i + t][j + 1] * h);
        ans %= p;
      }
      dp[i][j] = ans;
    }
  }
  cout << dp[0][0] << endl;
  return 0;
}
