#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000;
const int MOD = 1000000007;
int N;
int M;
int a[MAX_N + 1];
int comb(int n, int r) {
  int num = 1;
  for (int i = 1; i <= r; i++) {
    num = num * (n - i + 1) / i;
  }
  return num;
}
int reach(int x) {
  int cnt = 0;
  for (int i = 0; i <= x; i++) {
    if ((x - i) % 2 == 0) {
      cnt += comb(i + (x - i) / 2, i);
    }
  }
  return cnt;
}
int main() {
  cin >> N >> M;
  for (int i = 0; i < M; i++) cin >> a[i];
  long long cnt = 1;
  bool frag = false;
  int p = reach(a[0] - 1);
  cnt *= p;
  for (int i = 0; i < M - 1; i++) {
    if (a[i + 1] - a[i] < 2) {
      frag = true;
      break;
    }
    int q = reach(a[i + 1] - a[i] - 2);
    cnt *= q;
  }
  p = reach(N - a[M - 1] - 1);
  cnt *= p;
  cnt = cnt % MOD;
  if (frag)
    cout << 0 << endl;
  else
    cout << cnt << endl;
}
