#include <bits/stdc++.h>
using namespace std;
int kai(int k) {
  long long int sum = 1;
  for (int i = 1; i <= k; ++i) sum *= i;
  return sum;
}
int ptn(int r) {
  long long int sum = 1;
  int a, b;
  if (r == -1) return 1;
  for (int i = 0; i <= r / 2; i++) {
    a = i;
    b = r - (2 * i);
    sum += kai(a + b) / (kai(a) * kai(b));
  }
  cout << sum << ' ';
  return sum;
}
int main() {
  int n, m;
  cin >> n >> m;
  int a[m], r[m + 1];
  for (int i = 0; i < m; i++) cin >> a[i];
  r[0] = a[0] - 1;
  for (int i = 0; i < m; i++) {
    if (a[i + 1] - a[i] == 1) {
      cout << 0;
      return 0;
    }
    r[i + 1] = a[i + 1] - a[i];
  }
  r[m] = n - a[m - 1];
  long long int sum = 1;
  for (int i = 0; i <= m; i++) {
    sum *= ptn(r[i] - 2);
  }
  cout << sum % 1000000007;
  return 0;
}
