#include <bits/stdc++.h>
using namespace std;
void print(long long int a[], long long int n) {
  for (long long int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << "\n";
}
long long int power1(long long int x) {
  long long int u = 0;
  while (x > 0) {
    u++;
    x = x / 2;
  }
  return u;
}
long long int powM(long long int x, long long int y, long long int m) {
  if (m == 1) {
    return 0;
  }
  long long int ans = 1, r = 1;
  x %= m;
  while (r > 0 && r <= y) {
    if (r & y) {
      ans *= x;
      ans %= m;
    }
    r <<= 1;
    x *= x;
    x %= m;
  }
  return ans;
}
long long int powm(long long int a, long long int b) {
  long long int res = 1;
  while (b) {
    if (b & 1) res = (res * a);
    a = (a * a);
    b >>= 1;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool isPrime(int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t2 = 1;
  long long int M = 1e9 + 7;
  long long int fac[1001];
  fac[0] = 1;
  for (long long int i = 1; i < 1001; i++) {
    fac[i] = (fac[i - 1] * i) % M;
  }
  while (t2--) {
    long long int n;
    cin >> n;
    long long int m;
    cin >> m;
    long long int a[m];
    for (long long int i = 0; i < m; i++) {
      cin >> a[i];
    }
    sort(a, a + m);
    vector<long long int> v;
    v.push_back(a[0] - 1);
    for (long long int i = 1; i < m; i++) {
      v.push_back(a[i] - a[i - 1] - 1);
    }
    v.push_back(n - a[m - 1]);
    long long int u = 1;
    long long int p = 0;
    long long int den = 1;
    for (long long int i = 1; i < (long long int)v.size() - 1; i++) {
      u = (u * powM(2, v[i] - 1, M)) % M;
    }
    for (long long int i = 0; i < v.size(); i++) {
      p += v[i];
      den = (den * fac[v[i]]) % M;
    }
    long long int num = 1;
    for (long long int i = 1; i < p + 1; i++) {
      num = (num * i) % M;
    }
    u = (u * num) % M;
    u = (u * powM(den, M - 2, M)) % M;
    cout << u << "\n";
  }
  return 0;
}
