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