#include <bits/stdc++.h>
using namespace std;
long long fPow(long long n, long long e, long long p = long(1e9 + 7)) {
  if (n == 1 || e <= 0)
    return 1;
  else if (e == 1)
    return n;
  else {
    long long sq = fPow(n, e >> 1);
    return (fPow(n, e & 1) * sq * sq) % p;
  }
}
long long mod_inv(long long b, long long a = long(1e9 + 7), long long c1 = 1,
                  long long c2 = 0, long long d1 = 0, long long d2 = 1) {
  if (b == 0) return -1;
  long q = a / b;
  long r = a % b;
  if (r == 1) {
    long inv = (c2 - q * d2);
    while (inv < long(1e9 + 7)) inv += long(1e9 + 7);
    return inv % long(1e9 + 7);
  }
  return mod_inv(r, b, d1, d2, c1 - q * d1, c2 - q * d2);
}
vector<long long> FACT, FACTINV;
void init() {
  FACT.assign(2000 + 1, 1);
  FACTINV.assign(2000 + 1, 1);
  FACTINV[1] = FACT[1] = 1;
  for (int i = 2; i < 2000; i++) {
    FACT[i] = i * FACT[i - 1] % long(1e9 + 7);
    FACTINV[i] = mod_inv(FACT[i]);
  }
}
long long nCr(long long n, long long r) {
  if (n == r) return 1;
  return FACT[n] * FACTINV[r] % long(1e9 + 7) * FACTINV[n - r] % long(1e9 + 7);
}
void mul(long long& a, long long b) {
  a *= b;
  a %= long(1e9 + 7);
  if (a < long(1e9 + 7)) a += long(1e9 + 7);
}
int main() {
  init();
  long long n, i, j, k, t, y, m;
  vector<string> S;
  cin >> n >> m;
  vector<long long> A(m);
  for (i = 0; i < m; ++i) cin >> A[i];
  sort(A.begin(), A.end());
  long long prev = 1;
  long long ans = FACT[n - m];
  for (i = 0; i < m - 1; ++i) {
    long long diff = A[i + 1] - A[i] - 1;
    mul(ans, FACTINV[diff]);
    mul(ans, fPow(2, diff - 1));
  }
  if (A[0] != 1) {
    mul(ans, FACTINV[A[0] - 1]);
  }
  if (A.back() != n) {
    mul(ans, FACTINV[n - A.back()]);
  }
  cout << ans % long(1e9 + 7);
}
