#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int64_t step(pair<int, int> p) {
  int steps = p.second - p.first, num1 = steps % 2, num2 = steps / 2;
  int64_t var;
  if (num1 == 0)
    var = 1;
  else
    var = num1 + num2;
  int ans = var;
  while (num1 < steps) {
    var = var * (num1 + num2 + 1) * num2 / (num1 + 1) / (num1 + 2);
    ans = (ans % mod) + (var % mod);
    num1 += 2;
    num2--;
  }
  return ans % mod;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> a(m + 1);
  int start = 0, broken;
  bool possible = true;
  for (int i = 0; i < m; i++) {
    cin >> broken;
    if (start == broken) {
      possible = false;
      break;
    }
    a.at(i) = make_pair(start, broken - 1);
    start = broken + 1;
  }
  a.at(m) = make_pair(start, n);
  int64_t ans = 1;
  if (possible) {
    for (auto i : a) ans = (ans % mod) * step(i);
  } else
    ans = 0;
  cout << ans % mod << endl;
}
