#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
long long int inv[1011];
long long int fact[1011];
long long int factinv[1001];
inline long long int com(int a, int b) {
  return fact[a] * factinv[b] % mod * factinv[a - b] % mod;
}
vector<int> initializeDiffArray(vector<int>& A) {
  int n = A.size();
  vector<int> D(n + 1);
  D[0] = A[0], D[n] = 0;
  for (int i = 1; i < n; i++) D[i] = A[i] - A[i - 1];
  return D;
}
void update(vector<int>& D, int l, int r, int x) {
  D[l] += x;
  D[r + 1] -= x;
}
long long int printArray(vector<int>& A, vector<int>& D) {
  long long int p;
  for (int i = 0; i < A.size(); i++) {
    if (i == 0)
      A[i] = D[i];
    else
      A[i] = D[i] + A[i - 1];
    if (i == 0) {
      p = A[i];
    } else {
      p *= A[i];
      p %= 1000000007;
    }
  }
  return p;
}
int main() {
  inv[1] = 1;
  for (int i = 2; i < 1011; i++)
    inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod;
  fact[0] = factinv[0] = 1;
  for (int i = 1; i < 1011; i++) {
    fact[i] = fact[i - 1] * i % mod;
    factinv[i] = factinv[i - 1] * inv[i] % mod;
  }
  vector<int> A;
  int n, k, tmp;
  long long int k2 = 1;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    A.push_back(0);
  }
  vector<int> D = initializeDiffArray(A);
  for (int i = 0; i < k; i++) {
    cin >> tmp;
    k2 *= com(n, tmp);
    k2 %= 1000000007;
    if (i % 2 == 0)
      update(D, 0, tmp - 1, 1);
    else
      update(D, n - tmp, n - 1, 1);
  }
  long long int p;
  p = printArray(A, D);
  cout << (p * k2) % 1000000007 << endl;
  return 0;
}
