#include <bits/stdc++.h>
using namespace std;
long long factorial(long long n) {
  if (n > 1) {
    return (n * factorial(n - 1));
  } else {
    return 1;
  }
}
int main() {
  long long n;
  long long m;
  cin >> n >> m;
  vector<long long> A(m);
  for (long long i = 0; i < m; i++) {
    cin >> A.at(i);
  }
  if (m > 1) {
    for (long long i = 0; i < m - 1; i++) {
      if (A.at(i + 1) - A.at(i) == 1) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  vector<long long> B;
  if (m > 0) {
    B.push_back(A.at(0));
    A.push_back(n + 1);
    for (long long i = A.size() - 2; i >= 0; i--) {
      B.push_back(A.at(i + 1) - A.at(i) - 1);
    }
  } else {
    B.push_back(n + 1);
  }
  long long div = 1000000007;
  long long ans = 1;
  for (long long i = 0; i < B.size(); i++) {
    if (B.at(i) < 3) {
      continue;
    }
    long long c = B.at(i) - 1;
    long long two_max = c / 2;
    long long a = 0;
    for (long long two = 0; two <= two_max; two++) {
      long long one = c - (2 * two);
      a += (factorial(one + two) / (factorial(one) * factorial(two))) % div;
    }
    ans *= (a % div);
    ans %= div;
  }
  cout << ans << endl;
}
