#include <bits/stdc++.h>
using namespace std;
long long fac[100005], finv[100005], inv[100005];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < 100005; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % 1000000007) % 1000000007;
}
int main() {
  COMinit();
  int n, m, a[10005], p = 0, q, b, c, k = 0;
  cin >> n >> m;
  long long ans = 1;
  bool x = false;
  for (int i = 0; i < m; i++) cin >> a[i];
  for (int i = 0; i < m - 1; i++) {
    if (a[i] == a[i + 1] - 1) x = true;
  }
  if (x)
    cout << 0 << endl;
  else {
    for (int i = 0; i < m; i++) {
      c = k = 0;
      q = a[i];
      b = q - p - 1;
      while (b >= (q - p - 1) / 2 + (q - p - 1) % 2) {
        c += COM(b, k);
        c %= 1000000007;
        b--;
        k++;
      }
      ans = (ans * c) % 1000000007;
      p = a[i] + 1;
      ;
    }
    q = n;
    c = k = 0;
    b = q - p;
    while (b >= (q - p) / 2 + (q - p) % 2) {
      c += COM(b, k);
      c %= 1000000007;
      b--;
      k++;
    }
    ans = (ans * c) % 1000000007;
    cout << ans << endl;
  }
  return 0;
}
