#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long fact[100001];
  fact[0] = 1;
  for (int i = 1; i < 100001; i++) {
    fact[i] = i * fact[i - 1] % 1000000007;
  }
  int n, m;
  int lastA = -1;
  cin >> n >> m;
  int index = 0;
  vector<long long> ans(n, 0);
  for (int i = 0; i < m; i++) {
    int a;
    cin >> a;
    if (a - lastA == 1) {
      ans[index] = 0;
      break;
    } else if (a == lastA) {
      ans[index] = 1;
      index++;
      continue;
    } else {
      int now = lastA + 1;
      int diff = a - now - 1;
      for (int i = 0; i < diff / 2 + 1; i++) {
        if (i == 0 || i == diff / 2 && diff % 2 == 0)
          ans[index] += 1;
        else {
          long long b = fact[diff - i];
          long long c = fact[i];
          long long d = fact[(diff - 2 * i)];
          double e = b / d;
          ans[index] += ((long long)((b / c) / d) % (1000000007));
        }
      }
      lastA = a;
      index++;
    }
  }
  int a = n;
  if (a - lastA == 1) {
    ans[index] = 0;
  } else if (a == lastA)
    ;
  else {
    int now = lastA + 1;
    int diff = a - now;
    for (int i = 0; i < diff / 2 + 1; i++) {
      if (i == 0 || i == diff / 2 && diff % 2 == 0)
        ans[index] += 1;
      else {
        long long b = fact[diff - i];
        long long c = fact[i];
        long long d = fact[(diff - 2 * i)];
        double e = b / d;
        ans[index] += ((long long)((b / c) / d) % (1000000007));
      }
    }
    lastA = a;
  }
  long long as = 1;
  for (int i = 0; i < m + 1; i++) {
    as *= ans[i];
    as %= 1000000007;
  }
  cout << as << endl;
}
