#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
constexpr ll d = 1000000007;
int n, m;
vector<int> a;
map<int, int> memo;
map<pair<int, int>, ll> cmemo;
ll xCr(int x, int r) {
  auto itr = cmemo.find(pair<int, int>(x, r));
  if (itr != cmemo.end()) {
    return itr->second;
  } else {
    int ret = 1;
    for (ll i = 1; i <= r; i++) {
      ret = ret * (x - i + 1) / i;
    }
    cmemo[pair<int, int>(x, r)] = ret;
    return ret;
  }
}
int num(int x) {
  x--;
  if (memo[x] != 0) return memo[x];
  ll ret = 0;
  if (x == 0) return 1;
  for (int i = 0; i < x / 2 + 1; i++) {
    int j = x - 2 * i;
    ret += xCr(i + j, min(i, j)) % d;
    ret = ret % d;
  }
  memo[x] = ret;
  return ret;
}
int main(void) {
  cin >> n >> m;
  a.push_back(-1);
  for (int i = 0; i < m; i++) {
    int ai;
    cin >> ai;
    a.push_back(ai);
  }
  a.push_back(n + 1);
  ll ret = 1;
  for (size_t i = 0; i < m + 1; i++) {
    if (a[i + 1] - a[i] == 1) {
      ret = 0;
      break;
    }
    ret *= num(a[i + 1] - a[i] - 1);
    ret %= d;
  }
  cout << ret << endl;
  return 0;
}
