#include <bits/stdc++.h>
using namespace std;
long long mm = 1000000000;
long long MM = mm + 7;
int main() {
  long long z = 1;
  vector<long long> times(100001);
  times.at(0) = 1;
  for (int i = 1; i <= 100000; i++) {
    z *= i;
    times.at(i) = z;
  }
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i);
  }
  long long cnt = 1;
  for (int i = 0; i < m + 1; i++) {
    int diff;
    if (i == 0)
      diff = a.at(i) - 1;
    else if (i == m)
      diff = n - a.at(m - 1) - 1;
    else
      diff = a.at(i) - a.at(i - 1) - 2;
    if (diff == -1)
      cnt *= 0;
    else if (diff == 0)
      cnt *= 1;
    else if (diff % 2 == 0) {
      long long x = 0;
      for (int j = 0; j < (diff / 2) + 1; j++) {
        x += times.at(diff - j) / (times.at(j) * times.at(diff - 2 * j));
      }
      cnt *= x;
    } else if (diff % 2 == 1) {
      long long y = 0;
      for (int j = 0; j < diff / 2 + 1; j++) {
        y += times.at(diff - j) / (times.at(j) * times.at(diff - 2 * j));
      }
      cnt *= y;
    }
    cnt %= MM;
  }
  cout << cnt << endl;
}
