#include <bits/stdc++.h>
using namespace std;
long long f[1200];
long long mod = 1000000007;
int arr[1100];
long long pw(long long x, long long sum) {
  long long res = 1, power = sum, val = x;
  while (power) {
    if (power & 1) {
      res *= val;
      res %= mod;
    }
    val *= val;
    val %= mod;
    power >>= 1ll;
  }
  return res;
}
int main() {
  f[0] = 1;
  for (int i = 1; i <= 1000; i++) f[i] = (f[i - 1] * i) % mod;
  int n, m;
  cin >> n >> m;
  long long ans = f[n - m];
  vector<int> vec;
  for (int i = 0; i < m; i++) {
    scanf("%d", &arr[i]);
  }
  sort(arr, arr + m);
  if (!m)
    vec.push_back(n);
  else {
    vec.push_back(arr[0] - 1);
    for (int i = 1; i < m; i++) vec.push_back(arr[i] - arr[i - 1] - 1);
    vec.push_back(n - arr[m - 1]);
  }
  long long sum = 1;
  for (int i = 0; i < vec.size(); i++) sum = (sum * f[vec[i]]) % mod;
  ans = (ans * pw(sum, mod - 2)) % mod;
  for (int i = 1; i < vec.size() - 1; i++)
    if (vec[i] - 1 && vec[i]) ans = (ans * pw(2, vec[i] - 1)) % mod;
  cout << ans << endl;
  return 0;
}
