#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
long long Pow(long long b, long long e) {
  if (!e) return 1;
  long long ret = Pow(b, e / 2);
  ret = (ret * ret) % mod;
  if (e & 1) ret = (ret * b) % mod;
  return ret;
}
long long fact[1111], n, m, g[1111];
int main() {
  cin >> n >> m;
  int l = 0;
  for (int i = 0; i < m; ++i) cin >> g[i];
  sort(g, g + m);
  vector<int> v;
  for (int i = 0; i < m; ++i) {
    if (g[i] - l - 1 > 0) v.push_back(g[i] - l - 1);
    l = g[i];
  }
  if (n - l > 0) v.push_back(n - l);
  fact[0] = 1;
  for (int i = 1; i < 1111; ++i) fact[i] = fact[i - 1] * i % mod;
  long long res = fact[n - m];
  for (int i = 0; i < v.size(); ++i) res = res * Pow(fact[v[i]], mod - 2) % mod;
  for (int i = g[0] != 1; i + (g[m - 1] != n) < v.size(); ++i)
    res = res * Pow(2, v[i] - 1) % mod;
  cout << res << endl;
}
