#include <bits/stdc++.h>
using namespace std;
unsigned long div(unsigned long a, unsigned long b) {
  unsigned long ret = 0;
  long i;
  for (i = __builtin_clz(b); i >= 0; i--) {
    if (a >= (b << i)) {
      a -= b << i;
      ret += 1 << i;
    }
  }
  return ret;
}
unsigned long combination(int n, int m) {
  if (n - m < m) m = n - m;
  unsigned long denominator = 1;
  unsigned long numerator = 1;
  for (int i = 1; i <= m; i++) {
    denominator *= i;
    numerator *= (n - i + 1);
  }
  return div(numerator, denominator);
}
unsigned long local_step_combination(int step) {
  unsigned long local_combination = 0;
  for (int j = 0; j <= step / 2; j++) {
    local_combination += combination(step - j, j);
  }
  return local_combination;
}
int main() {
  int n, m;
  cin >> n >> m;
  int a[m];
  for (int i = 0; i < m; i++) cin >> a[i];
  unsigned long total_combination = 1;
  for (int i = 0; i < m; i++) {
    if (i != m - 1 && a[i] + 1 == a[i + 1]) {
      cout << 0 << endl;
      return 0;
    }
    int step = (i != 0) ? a[i] - a[i - 1] - 2 : a[0] - 1;
    total_combination *= local_step_combination(step);
  }
  int step = n - a[m - 1] - 1;
  total_combination *= local_step_combination(step);
  cout << total_combination % 1000000007u << endl;
  return 0;
}
