#include <bits/stdc++.h>
using namespace std;
long long int nCr(int n, int r) {
  if (n == r) return 1;
  if (r == 0) return 1;
  if (r == 1) return n;
  return nCr(n - 1, r) + nCr(n - 1, r - 1);
}
int main() {
  long long int ans = 1, cnt;
  int N, M, i, j, k, flag = 0, diff;
  cin >> N >> M;
  int a[M];
  long long int tmp[M + 1];
  for (i = 0; i < M; i++) cin >> a[i];
  if (M >= 2) {
    for (i = 0; i < M - 1; i++) {
      if (a[i + 1] - a[i] == 1) flag = 1;
    }
  }
  if (flag == 1)
    ans = 0;
  else {
    diff = a[0] - 1;
    cnt = 0;
    for (j = 0; j * 2 <= diff; j++) {
      k = diff - j * 2;
      cnt += nCr(j + k, j);
    }
    tmp[0] = cnt;
    for (i = 1; i < M; i++) {
      diff = a[i] - a[i - 1] - 2;
      cnt = 0;
      for (j = 0; j * 2 <= diff; j++) {
        k = diff - j * 2;
        cnt += nCr(j + k, j);
      }
      tmp[i] = cnt;
    }
    diff = N - a[M - 1] - 1;
    cnt = 0;
    for (j = 0; j * 2 <= diff; j++) {
      k = diff - j * 2;
      cnt += nCr(j + k, j);
    }
    tmp[M] = cnt;
    for (i = 0; i <= M; i++) {
      ans = ans * (tmp[i]) % 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
