#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int x, long long int y) {
  while (y != 0) {
    if (x > y) {
      long long int r = x % y;
      x = y;
      y = r;
    } else {
      long long int r = y % x;
      y = r;
    }
  }
  return x;
}
long long int cou = 0;
void dfs(long long int x, long long int y) {
  if (x == y)
    cou++;
  else if (x < y) {
    dfs(x + 1, y);
    dfs(x + 2, y);
  }
  if (x > y) {
    return;
  }
}
int main(void) {
  long long int N, M;
  long long int ans = 1;
  cin >> N >> M;
  vector<long long int> a(M + 2);
  for (int i = 0; i < M + 2; i++) {
    cin >> a[i];
    if (i == M) a[i] = -1;
    if (i == M + 1) a[i] = N + 1;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < M + 1; i++) {
    dfs(a[i] + 1, a[i + 1] - 1);
    ans *= cou;
    cou = 0;
  }
  cout << ans % 1000000007 << endl;
}
