#include <bits/stdc++.h>
using namespace std;
int INF = 1001001001;
int DIV = 1000000007;
long long combination(int a, int b) {
  long long x = 1, y = 1;
  for (int i = 0; i < b; i++) {
    x *= a - i;
    y *= (i + 1);
  }
  return x / y;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    if (i >= 1) {
      if (abs(a[i - 1] - a[i]) <= 1) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  long long res = 1;
  int before = 0;
  int after = n;
  for (int i = 0; i < m + 1; i++) {
    if (i == m) {
      after = n;
    } else {
      after = a[i] - 1;
    }
    int c = after - before;
    if (c > 1) {
      long long tmp = 0;
      if (c % 2 == 0) {
        int a = c / 2;
        for (int j = 0; j < a + 1; j++) {
          tmp += combination(a + j, 2 * j);
        }
      } else if (c % 2 == 1) {
        int a = c / 2;
        for (int j = 0; j < a + 1; j++) {
          tmp += combination(a + j + 1, 2 * j + 1);
        }
      }
      res = res * tmp % DIV;
    }
    before = after + 2;
  }
  res = res % DIV;
  cout << res << endl;
  return 0;
}
