#include <bits/stdc++.h>
using namespace std;
long patterns(int);
int main() {
  int N, M, i, j;
  cin >> N >> M;
  int broken[M + 2];
  broken[0] = -1;
  broken[M + 1] = N + 1;
  for (i = 1; i < M + 1; i++) {
    cin >> broken[i];
  }
  double pattern = 1;
  for (j = 1; j < M + 2; j++) {
    if (broken[j] - broken[j - 1] - 2 == -1) {
      cout << 0 << endl;
      return 0;
    } else {
      pattern *= patterns(broken[j] - broken[j - 1] - 2);
    }
  }
  cout << fmod(pattern, 1000000007) << endl;
  return 0;
}
long patterns(int length) {
  int n1 = length, n2 = 0;
  double e = 0;
  while (n1 > -1) {
    e += tgamma(n1 + n2 + 1) / (tgamma(n1 + 1) * tgamma(n2 + 1));
    n1 = n1 - 2;
    n2++;
  }
  return e;
}
