#include <bits/stdc++.h>
const long long MOD = 1e9 + 7, INF = 1e18;
using namespace std;
long long n, m, fact[1000001], ans, a[1000000];
long long qpow(long long a, long long b) {
  long long s = 1;
  while (b) {
    if (b % 2) s = s * a % MOD;
    a = a * a % MOD;
    b /= 2;
  }
  return s;
}
long long C(long long n, long long k) {
  return fact[n] * qpow(fact[k] * fact[n - k] % MOD, MOD - 2) % MOD;
}
int main() {
  cin >> n >> m;
  fact[0] = 1;
  for (long long i = 1; i <= n; i++) fact[i] = i * fact[i - 1] % MOD;
  for (int i = 0; i < m; i++) {
    scanf("%lld", &a[i]);
  }
  sort(a, a + m);
  ans = 1;
  for (int i = 1; i < m; i++) {
    if (a[i] != a[i - 1] + 1) ans = ans * qpow(2, a[i] - a[i - 1] - 2) % MOD;
    ans = ans * C(a[i] - i - 1, a[i] - a[i - 1] - 1) % MOD;
  }
  ans = ans * C(n - m, n - a[m - 1]) % MOD;
  cout << ans;
}
