#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const long long LINF = 1000000000000000000;
const double EPS = 1e-10;
const long long divider = 1000000007;
long long factorial(long long num) {
  long long result = 1;
  for (long long i = 1; i <= num; i++) {
    result *= i;
  }
  return (result);
}
long long calc_pattern(long long one, long long two) {
  long long upper = factorial(one + two);
  long long lower = factorial(one) * factorial(two);
  return (upper / lower);
}
int main(void) {
  int N, M;
  cin >> N >> M;
  vector<int> a(M + 1);
  a[0] = 0;
  for (int i = 1; i < M + 1; i++) {
    cin >> a[i];
  }
  a.push_back(N);
  int diff;
  for (int i = 2; i < M + 1; i++) {
    diff = a[i] - a[i - 1];
    if (diff == 1) {
      printf("0\n");
      return (0);
    }
  }
  long long ans = 1;
  int distance;
  long long cnt;
  for (int i = 1; i < M + 2; i++) {
    distance = a[i] - a[i - 1] - 1;
    cnt = 0;
    if (distance > 0) {
      for (int two = 0; two <= distance / 2; two++) {
        int one = distance - two * 2;
        if (one * 1 + two * 2 == distance) {
          cnt += calc_pattern(one, two);
        }
      }
    }
    if (cnt != 0) {
      ans *= cnt;
      ans %= divider;
    }
  }
  cout << ans << endl;
  return (0);
}
