#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * asin(1.0);
const int INF = 1000000000;
const double EPS = 1e-10;
const int MOD = 1000000007;
inline int cmp(double x, double y = 0, double tol = EPS) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
inline long long gcd(long long n1, long long n2) {
  return n2 == 0 ? abs(n1) : gcd(n2, n1 % n2);
}
inline long long lcm(long long n1, long long n2) {
  return n1 == 0 || n2 == 0 ? 0 : abs(n1 * (n2 / gcd(n1, n2)));
}
long long fat[1001], pow2[1001];
long long fastexp(long long x, int p) {
  if (p == 0) return 1;
  long long r = 1, s = x;
  while (p) {
    if (p & 1) r = (r * s) % MOD;
    s = (s * s) % MOD;
    p >>= 1;
  }
  return r;
}
long long lamps[1002];
int main() {
  fat[0] = pow2[0] = 1;
  for (int i = 1; i < 1001; ++i) fat[i] = (fat[i - 1] * i) % MOD;
  for (int i = 1; i < 1001; ++i) pow2[i] = (pow2[i - 1] * 2) % MOD;
  int n, m;
  cin >> n >> m;
  long long res = fat[n - m];
  for (int i = 1; i < m + 1; ++i) cin >> lamps[i];
  sort(lamps + 1, lamps + m + 1);
  lamps[0] = 0;
  lamps[m + 1] = n + 1;
  for (int i = 1; i < m + 2; ++i) {
    int x = lamps[i - 1], y = lamps[i];
    int l = y - x - 1;
    if (l > 0) {
      if (i > 1 && i < m + 1) res = (res * pow2[l - 1]) % MOD;
      res = (res * fastexp(fat[l], MOD - 2)) % MOD;
    }
  }
  cout << res << endl;
  return 0;
}
