#include <bits/stdc++.h>
using namespace std;
const long long MODULO = 1000000007;
void ftime() {}
void print_arr(int n, bool arr[]) {
  for (int i = 0; i < n; i++) {
    cout << arr[i] << " ";
  }
  cout << "\n";
}
void print_arr(int n, int arr[]) {
  for (int i = 0; i < n; i++) {
    cout << arr[i] << " ";
  }
  cout << "\n";
}
void print_vec(vector<int> &vec) {
  for (auto e : vec) {
    cout << e << " ";
  }
  cout << "\n";
}
void print_vec(vector<long long> &vec) {
  for (auto e : vec) {
    cout << e << " ";
  }
  cout << "\n";
}
void print_vec(vector<bool> &vec) {
  for (auto e : vec) {
    cout << e << " ";
  }
  cout << "\n";
}
static int speed_increase = []() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(NULL);
  return 0;
}();
void print_map(unordered_map<long long, long long> &comp) {
  for (auto e : comp) {
    cout << e.first << " : " << e.second << "\n";
  }
  cout << "\n";
}
vector<long long> fdp(1000, -1);
long long fact(long long val) {
  if (fdp[val] > 0) {
    return fdp[val];
  }
  if (val < 2) return 1;
  fdp[val] = (val * fact(val - 1)) % MODULO;
  return fdp[val];
}
long long modexp(long long base, long long exponent) {
  long long res = 1;
  base = (base % MODULO + MODULO) % MODULO;
  while (exponent) {
    if (exponent & 1) res = (res * base) % MODULO;
    exponent >>= 1;
    base = (base * base) % MODULO;
  }
  return res;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<long long> vals(m + 1, 0);
  vector<long long> lights(m, 0);
  for (auto &x : lights) {
    cin >> x;
  }
  sort(lights.begin(), lights.end());
  int last = 0;
  int curr;
  for (int i = 0; i < m; i++) {
    curr = lights[i];
    vals[i] = curr - last - 1;
    last = curr;
  }
  vals[m] = n - last;
  long long sum = accumulate(vals.begin(), vals.end(), 0ll);
  long long ans = fact(sum) % MODULO;
  for (int i = 0; i < m + 1; i++) {
    if (vals[i] > 1) {
      ans *= modexp(fact(vals[i]), MODULO - 2);
      ans %= MODULO;
    }
    if (i != 0 && i != m && vals[i] > 1) {
      ans *= modexp(2, vals[i] - 1);
      ans %= MODULO;
    }
  }
  cout << ans;
  ftime();
  return 0;
}
