#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
inline long long power(long long a, long long n, long long m) {
  if (n == 0) return 1;
  long long p = power(a, n / 2, m);
  p = (p * p) % m;
  if (n % 2)
    return (p * a) % m;
  else
    return p;
}
const long long MOD = 1000000007;
const int N = 300001;
long long int n, m;
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> m;
  vector<long long int> ms;
  for (long long int i = 0; i < m; i++) {
    long long int a;
    cin >> a;
    ms.push_back(a);
  }
  sort(ms.begin(), ms.end());
  long long int fact[1001];
  fact[0] = fact[1] = 1;
  for (long long int i = 2; i < 1001; i++) {
    fact[i] = (fact[i - 1] * i) % MOD;
  }
  long long int ans = fact[n - m];
  long long int lst = 0;
  for (long long int i = 0; i < m; i++) {
    long long int now = ms[i];
    ans = (ans * power(fact[now - lst - 1], MOD - 2, MOD)) % MOD;
    lst = now;
  }
  ans = (ans * power(fact[n - lst], MOD - 2, MOD)) % MOD;
  for (long long int i = 1; i < m; i++) {
    ans = (ans * power(2, max(ms[i] - ms[i - 1] - 2, 0LL), MOD)) % MOD;
  }
  cout << ans;
}
