#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
long long int f[1010100];
void init() {
  f[0] = 1;
  for (int i = 1; i < 1010100; i++) f[i] = (f[i - 1] * i) % mod;
}
long long int inv(long long int x) {
  long long int res = 1;
  long long int k = mod - 2;
  long long int y = x;
  while (k) {
    if (k & 1) res = (res * y) % mod;
    y = (y * y) % mod;
    k /= 2;
  }
  return res;
}
long long int C(int n, int k) {
  long long int a = f[n];
  long long int b = f[n - k];
  long long int c = f[k];
  long long int bc = (b * c) % mod;
  return (a * inv(bc)) % mod;
}
void Main() {
  init();
  int n, m;
  cin >> n >> m;
  int a[m];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  int step = 0;
  long long ans = 1;
  for (int i = 0; i < m; i++) {
    if (step == a[i]) {
      cout << 0 << endl;
      return;
    }
    long long t = 1;
    long long rng = a[i] - 1 - step;
    if (rng > 1) {
      for (int j = 1; j < rng / 2; j++) {
        t = (t + C(j + (rng - j * 2), j)) % mod;
      }
      if (rng % 2 == 0) t++;
    }
    step = a[i] + 1;
    ans = ans * t % mod;
  }
  long long t = 1;
  long long rng = n - step;
  if (rng > 1) {
    if (rng % 2 == 0) t++;
    for (int j = 1; j < rng / 2; j++) {
      t = (t + C(j + (rng - j * 2), j)) % mod;
    }
  }
  ans = ans * t % mod;
  cout << ans << endl;
}
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}
