#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long modpow(long long a, long long n) {
  long long r = 1;
  while (n) {
    r = r * ((n % 2) ? a : 1) % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return r;
}
long long modcomb(int n, int k) {
  if (n < 0 || k < 0 || k > n) return 0;
  k = min(k, n - k);
  long long p = 1, q = 1;
  while (k > 0) {
    p = p * n-- % mod;
    q = q * k-- % mod;
  }
  return p * modpow(q, mod - 2) % mod;
}
int main() {
  const int MAX_M = 1e5 + 10;
  int N, M, a[MAX_M];
  cin >> N >> M;
  a[0] = -1;
  for (int i = 1; i <= M; ++i) {
    cin >> a[i];
  }
  a[M + 1] = N + 1;
  long long ans = 1;
  int l, r, d;
  for (int i = 0; i <= M; i++) {
    l = a[i] + 1;
    r = a[i + 1] - 1;
    d = r - l;
    long long sum = 0;
    for (int j = 0; j <= (d / 2); ++j) {
      sum = (sum + modcomb(d - j, j)) % mod;
    }
    ans = ans * sum % mod;
  }
  cout << ans << endl;
  return 0;
}
