#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2, p);
}
long long int nCrModPFermat(long long int n, long long int r, long long int p) {
  if (r == 0) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
long long int nCrModpDP(long long int n, long long int r, long long int p) {
  long long int C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
long long int nCrModpLucas(long long int n, long long int r, long long int p) {
  if (r == 0) return 1;
  long long int ni = n % p, ri = r % p;
  return (nCrModpLucas(n / p, r / p, p) * nCrModpDP(ni, ri, p)) % p;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k, i, c[100], r, t, ans = 0, p = 1, a[100], ans1 = 1,
                                       sum = 0, z, m1, m2;
  cin >> n >> k;
  for (i = 0; i < k; i++) {
    cin >> a[i];
    sum = sum + a[i];
  }
  t = sum / n;
  r = sum - (n * t);
  m1 = n;
  for (i = 0; i < n; i++) {
    c[i] = t;
    if (r > 0) {
      c[i] = c[i] + 1;
      r--;
    }
    p = (p * c[i]) % 1000000007;
  }
  ans1 = 1;
  for (i = 0; i < k; i++) {
    z = nCrModpLucas(m1, a[i], 1000000007);
    ans1 = (z * ans1) % 1000000007;
  }
  ans = ((ans1 % 1000000007) * (p % 1000000007)) % 1000000007;
  cout << ans << endl;
  return 0;
}
