#include <bits/stdc++.h>
using namespace std;
long long m = 1000000007;
long long ncr(long long n, long long r) {
  long long sum = 1;
  for (long long i = 0; i < r; i++) {
    sum *= (n - i);
    sum /= (i + 1);
    sum %= m;
  }
  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;
}
