#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int MOD = 1e9 + 7;
int a[N], n, m, pw2;
vector<int> first;
int cnt[N];
long long fact[N];
long long bin(long long x, int y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % MOD;
    x = x * x % MOD;
    y /= 2;
  }
  return res;
}
int main() {
  fact[0] = 1;
  for (int i = 1; i < N; ++i) fact[i] = fact[i - 1] * i % MOD;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) cin >> a[i];
  sort(a, a + m);
  first.push_back(a[0] - 1);
  first.push_back(n - a[m - 1]);
  for (int i = 0; i + 1 < m; ++i)
    if (a[i + 1] - a[i] - 1 > 0) {
      pw2 += a[i + 1] - a[i] - 2;
      first.push_back(a[i + 1] - a[i] - 1);
    }
  n -= m;
  long long ans = fact[n];
  for (int i = 0; i < first.size(); ++i)
    ans = ans * bin(fact[first[i]], MOD - 2) % MOD;
  for (int i = 1; i <= pw2; ++i) ans = ans * 2 % MOD;
  cout << ans;
  return 0;
}
