#include <bits/stdc++.h>
using namespace std;
vector<long long> kai(1000000);
long long kaijou(long long n);
void comb(vector<vector<long long int> > &v) {
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int k = 1; k < v.size(); k++) {
    for (int j = 1; j < k; j++) {
      v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
    }
  }
}
int main() {
  kai[0] = 1;
  int n, m;
  cin >> n >> m;
  vector<long long> a(m);
  long long i, j;
  long long ans = 1;
  long long tmp = 0;
  vector<vector<long long int> > v(n, vector<long long int>(n, 0));
  comb(v);
  if (m == 0) {
    for (j = 0; j < (n / 2) + 1; j++) {
      tmp += v[n - j][n - j * 2];
    }
    cout << tmp << endl;
    return 0;
  }
  for (i = 0; i < m; i++) {
    cin >> a[i];
  }
  vector<long long> b(m + 1);
  for (i = 1; i < m; i++) {
    b[i] = a[i] - a[i - 1] - 2;
  }
  b[0] = a[0] - 1;
  b[m] = n - 1 - a[m - 1];
  for (i = 0; i < m + 1; i++) {
    if (b[i] == -1) {
      ans = 0;
      break;
    } else if (b[i] == -2) {
      continue;
    }
    for (j = 0; j < (b[i] / 2) + 1; j++) {
      tmp += v[b[i] - j][b[i] - j * 2];
    }
    ans *= tmp;
    if (ans > 1000000007) ans %= 1000000007;
    tmp = 0;
  }
  cout << ans << endl;
}
long long kaijou(long long n) {
  if (kai[n] != 0) return kai[n];
  long long i;
  long long tmp = 1;
  for (i = 1; i < n + 1; i++) {
    tmp *= i;
  }
  kai[n] = tmp;
  return tmp;
}
