#include <bits/stdc++.h>
using namespace std;
unsigned long long int func(int x) {
  unsigned long long int sum = 0;
  for (int i = 0; i <= x / 2; i++) {
    unsigned long long int mo = 1, chi = 1;
    for (int j = i; j > 0; j--) mo *= j;
    for (int j = x - i; j > x - i - i; j--) chi *= j;
    sum += chi / mo;
  }
  return sum;
}
void solve() {
  int n, m;
  cin >> n >> m;
  int a[m];
  for (int i = 0; i < m; i++) cin >> a[i];
  int s = 0;
  unsigned long long int ans = 1;
  for (int i = 0; i < m; i++) {
    if (a[i] == s) {
      cout << 0 << endl;
      return;
    }
    ans *= func(a[i] - 1 - s);
    s = a[i] + 1;
  }
  ans *= func(n - s);
  cout << ans % 1000000007 << endl;
  return;
}
int main() {
  solve();
  return 0;
}
