#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;
const int mod = 1000000007;
long long Cmat[1001][1001];
void solve() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      if (j == 0 || j == i)
        Cmat[i][j] = 1;
      else
        Cmat[i][j] = (Cmat[i - 1][j - 1] + Cmat[i - 1][j]) % mod;
    }
  }
  long long ans = 1;
  long long pow[1001];
  pow[0] = 1;
  pow[1] = 1;
  for (int i = 2; i <= n; i++) pow[i] = (pow[i - 1] * 2) % mod;
  vector<int> a(m);
  for (int i = 0; i < m; i++) cin >> a[i];
  sort(a.begin(), a.end());
  long long cnt = 0, tmp;
  for (int i = 0; i < m; i++) {
    if (i == 0)
      tmp = a[i] - 1;
    else {
      tmp = a[i] - a[i - 1] - 1;
      ans = (ans * pow[tmp]) % mod;
    }
    cnt += tmp;
    ans = (ans * Cmat[cnt][tmp]) % mod;
  }
  cnt += n - a[m - 1];
  ans = (ans * Cmat[cnt][n - a[m - 1]]) % mod;
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
