#include <bits/stdc++.h>
using namespace std;
long long kaijo(long long n) {
  long long m;
  if (n == 0) return 1;
  m = kaijo(n - 1);
  return n * m;
}
int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> a(M);
  vector<long long> b(M + 1);
  vector<long long> c(M + 1);
  long long ans = 1;
  bool judge = 1;
  for (long long i = 0; i < M; i++) {
    cin >> a.at(i);
    if (i != 0) {
      if (a.at(i) - a.at(i - 1) == 1) judge = 0;
    }
    if (i == 0)
      b.at(i) = a.at(i) - 1;
    else
      b.at(i) = a.at(i) - a.at(i - 1) - 2;
  }
  b.at(M) = N - a.at(M - 1) - 1;
  if (judge == 0)
    cout << 0 << endl;
  else {
    for (long long i = 0; i < M + 1; i++) {
      for (long long j = 0; j < b.at(i) / 2 + 1; j++) {
        c.at(i) += (kaijo(b.at(i) - j) / (kaijo(b.at(i) - 2 * j) * kaijo(j)) %
                    1000000007);
      }
      ans *= c.at(i) % 1000000007;
    }
    cout << ans % 1000000007 << endl;
  }
}
