#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}
std::vector<std::vector<long long>> comb(int n, int r) {
  std::vector<std::vector<long long>> v(n + 1,
                                        std::vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N = in<ll>(), M = in<ll>();
  vector<ll> A(M);
  for (int i = 0; i < (M); ++i) A[i] = in<ll>();
  ll num = 1, oldM = 0, oldA = -1;
  for (int i = 0; i < M; i++) {
    if (abs(oldA - A[i]) < 2) {
      cout << 0 << endl;
      return 0;
    }
    ll K = A[i] - oldM;
    ll psum = 0;
    for (int j = 0; K >= 2 * j + 1; j++) {
      auto c = comb(K - j - 1, j);
      psum += c[K - j - 1][j];
    }
    num *= psum;
    num %= 1000000007;
    oldA = A[i];
    oldM = oldA + 1;
  }
  if (abs(oldA - N + 1) < 2) {
    cout << 0 << endl;
    return 0;
  }
  ll K = N + 1 - oldM;
  ll psum = 0;
  for (int j = 0; K >= 2 * j + 1; j++) {
    auto c = comb(K - j - 1, j);
    psum += c[K - j - 1][j];
  }
  num *= psum;
  num %= 1000000007;
  cout << num << endl;
  return 0;
}
