#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M, a[100000] = {}, b[100000] = {}, c[100000] = {}, tmp, ans = 1;
  a[0] = -1;
  cin >> N >> M;
  for (int i = 1; i <= M; i++) {
    cin >> a[i];
    if ((a[i] - a[i - 1]) == 1) {
      cout << 0 << endl;
      return 0;
    }
    if (i == 1) {
      b[i - 1] = a[i] - 1;
    } else {
      b[i - 1] = a[i] - a[i - 1] - 2;
    }
  }
  b[M] = N - a[M] - 1;
  for (int i = 0; i <= M; i++) {
    c[i] = floor(b[i] / 2) + 1;
    ans = ans * c[i];
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
