#include <bits/stdc++.h>
using namespace std;
long long m = 1000000007;
long long fact(long long n) {
  long long f = 1;
  if (n <= 1) return 1;
  for (int i = 1; i <= n; i++) {
    f *= i;
    f %= m;
  }
}
long long ncr(long long n, long long r) {
  long long sum = 1;
  sum = fact(n) % m;
  long long a = fact(n - r) * fact(r);
  sum /= a;
  return sum;
}
int main() {
  long long n, k, sum = 1;
  cin >> n >> k;
  long long ar[k];
  for (int i = 0; i < k; i++) {
    cin >> ar[i];
    sum = (sum * ncr(n, ar[i])) % m;
  }
  cout << sum << endl;
}
