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