#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
int on[1002];
int intervals[1002];
int fact[1002], inv[1002];
int modpow(int b, int x) {
  ll ans = 1, n = b;
  while (x > 0) {
    if (x & 1) {
      ans = (ans * n) % MOD;
    }
    n = (n * n) % MOD;
    x >>= 1;
  }
  return ans;
}
void precomp() {
  fact[0] = inv[0] = 1;
  for (int i = 1; i < 1002; ++i) {
    fact[i] = ((ll)fact[i - 1] * i) % MOD;
    inv[i] = modpow(fact[i], MOD - 2);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    cin >> on[i];
  }
  sort(on, on + m);
  intervals[0] = on[0] - 1;
  for (int i = 1; i < m; ++i) {
    intervals[i] = on[i] - on[i - 1] - 1;
  }
  intervals[m] = n - on[m - 1];
  precomp();
  int ans = fact[n - m];
  for (int i = 0; i <= m; ++i) {
    int num = intervals[i];
    ans = ((ll)ans * inv[num]) % MOD;
  }
  for (int i = 1; i < m; ++i) {
    if (intervals[i] == 0) continue;
    ans = ((ll)ans * modpow(2, intervals[i] - 1)) % MOD;
  }
  cout << ans << endl;
  return 0;
}
