#include <bits/stdc++.h>
using namespace std;
int nCr(int n, int r) {
  int a = n;
  for (int i = 1; i < r; i++) a *= n - i;
  int b = r;
  for (int i = r - 1; i > 0; i--) b *= i;
  return a / b;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < m; i++) {
    if (a[i] - a[i - 1] == 1) {
      cout << '0' << endl;
      return 0;
    }
  }
  long long ans = 1;
  for (int i = 0; i < m; i++) {
    int start;
    if (!i)
      start = 0;
    else
      start = a[i - 1] + 1;
    int end = a[i] - 1;
    int c = 1;
    for (int j = 1; j <= end - start - j; j++) {
      c += nCr(end - start - j, j);
    }
    ans = ans * c % 1000000007;
    ;
  }
  int start = a[m - 1] + 1, end = n, c = 1;
  for (int j = 1; j <= end - start - j; j++) {
    c += nCr(end - start - j, j);
  }
  ans = ans * c % 1000000007;
  ;
  cout << ans << endl;
  return 0;
}
