#include <bits/stdc++.h>
using namespace std;
int parttern(int drop, int current) {
  int while_num = drop - current - 1;
  int two = while_num / 2;
  int one = while_num % 2;
  int p = 1;
  while (two) {
    int comb = two + one;
    int up = comb, under = 1;
    for (int j = 1; j < two; j++) {
      up *= up - 1;
      under *= under + 1;
    }
    p += up / under;
    two--;
    one += 2;
  }
  return p;
}
int main() {
  int N, M;
  bool f = false;
  const int div = 1000000007;
  cin >> N >> M;
  vector<int> a(M);
  cin >> a[0];
  for (int i = 1; i < M; i++) {
    cin >> a[i];
    if (a[i] - a[i - 1] <= 1) {
      f = true;
    }
  }
  if (f) {
    cout << 0 << endl;
  } else {
    int current = 0;
    int sum = 1;
    for (int i = 0; i < M; i++) {
      int p = parttern(a[i], current);
      current = a[i] + 1;
      sum *= p % div;
    }
    int p = parttern(N + 1, current);
    sum *= p % div;
    cout << sum % div << endl;
  }
}
