#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 3;
const int Mod = 1e9 + 7;
int n, m;
long long pow2[MAXN];
long long dn[MAXN][MAXN];
vector<int> ar;
long long comb(int n, int r) {
  if (r == 0 || n == r) return 1;
  if (r == 1 || r == n - 1) return n;
  if (dn[n][r]) return dn[n][r];
  return dn[n][r] = (comb(n - 1, r) + comb(n - 1, r - 1)) % Mod;
}
int main() {
  cin >> n >> m;
  for (int i = 0, a; i < m; i++) {
    scanf(" %d", &a);
    ar.push_back(a);
  }
  if (m + 1 >= n) {
    puts("1");
    return 0;
  }
  pow2[0] = 1;
  for (int i = 1; i <= n + 1; i++) pow2[i] = (pow2[i - 1] * 2LL) % Mod;
  sort(ar.begin(), ar.end());
  long long res = 1;
  for (int i = 1; i < m; i++)
    if (ar[i] - ar[i - 1] - 1 > 1)
      res = (res * pow2[ar[i] - ar[i - 1] - 2]) % Mod;
  long long cnt = n - m;
  res = (res * comb(cnt, ar[0] - 1)) % Mod;
  cnt -= ar[0] - 1;
  res = (res * comb(cnt, n - ar[m - 1])) % Mod;
  cnt -= n - ar[m - 1];
  for (int i = 1; i < m; i++) {
    res = (res * comb(cnt, ar[i] - ar[i - 1] - 1)) % Mod;
    cnt -= ar[i] - ar[i - 1] - 1;
  }
  cout << res << endl;
  return 0;
}
