#include <bits/stdc++.h>
using namespace std;
long long int n, m, modu = 1e9 + 7, prod = 1, sum = 0;
long long int power(long long int x, long long int y) {
  if (y == 0) return 1;
  if (y & 1) return (x * power((x * x) % modu, y >> 1)) % modu;
  return power((x * x) % modu, y >> 1);
}
long long int combine(long long int n, long long int r) {
  long long int p1 = 1, p2 = 1;
  for (int i = 1; i <= n; i++) p1 = (p1 * i) % modu;
  for (int i = 1; i <= r; i++) p2 = (p2 * i) % modu;
  for (int i = 1; i <= (n - r); i++) p2 = (p2 * i) % modu;
  return (p1 * (power(p2, modu - 2))) % modu;
}
int main() {
  cin >> n >> m;
  int prev = 0;
  vector<int> aa;
  for (int i = 0; i < m; i++) {
    long long int x;
    cin >> x;
    aa.push_back(x);
  }
  sort(aa.begin(), aa.end());
  for (int i = 0; i < m; i++) {
    long long int a = aa[i];
    long long int c = a;
    a = a - prev - 1;
    if (a > 0) {
      sum += a;
      if (i > 0 && i <= m - 1) prod = (prod * power(2, a - 1)) % modu;
      prod = (prod * combine(sum, a)) % modu;
    }
    prev = c;
  }
  if (n - prev > 0) {
    sum += (n - prev);
    prod = (prod * (combine(sum, n - prev))) % modu;
  }
  cout << prod << endl;
}
