#include <bits/stdc++.h>
using namespace std;
template <class T>
using v2d = vector<vector<T> >;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int maxN = 1e5 + 10;
const int maxM = 1e5 + 10;
const long long mod = 1e9 + 7;
int n, m;
int p[maxM];
long long ft[maxN], ift[maxN], res = 1;
long long power(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) {
      r = r * a % mod;
    }
    b /= 2;
    a = a * a % mod;
  }
  return r;
}
void init() {
  ft[0] = 1;
  for (int i = 1; i <= (int)(1000); ++i) {
    ft[i] = ft[i - 1] * i % mod;
  }
  ift[1000] = power(ft[1000], mod - 2);
  for (int i = (int)(1000) - 1; i >= 0; --i) {
    ift[i] = ift[i + 1] * (i + 1) % mod;
  }
}
long long nCk(long long n, long long k) {
  return ft[n] * ift[k] % mod * ift[n - k] % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  init();
  cin >> n >> m;
  for (int i = 1; i <= (int)(m); ++i) {
    cin >> p[i];
  }
  sort(p + 1, p + m + 1);
  vector<int> arr;
  long long s = n - m;
  for (int i = (int)(2); i <= (int)(m); ++i) {
    if (p[i] - p[i - 1] > 1) {
      arr.emplace_back(p[i] - p[i - 1] - 1);
    }
  }
  for (auto &r : arr) {
    res = res * power(2, r - 1) % mod * nCk(s, r) % mod;
    s -= r;
  }
  if (p[1] > 1) {
    res = res * nCk(s, p[1] - 1) % mod;
  }
  cout << res;
  return 0;
}
