#include <bits/stdc++.h>
using namespace std;
int mul(int x) {
  int y = 1;
  for (int i = 0; i < x; i++) {
    y *= x - i;
  }
  return y;
}
int main() {
  int n, m;
  int64_t ans = 1;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i);
  }
  vector<int> b(m + 1);
  for (int i = 0; i <= m; i++) {
    if (i == 0)
      b.at(0) = a.at(0);
    else if (i == m)
      b.at(m) = n - a.at(m - 1);
    else
      b.at(i) = a.at(i) - a.at(i - 1) - 1;
    if (b.at(i) == 0)
      ans *= 0;
    else if (b.at(i) == 1)
      ans *= 1;
    else if (b.at(i) == 2)
      ans *= 1;
    else if (b.at(i) % 2 == 0 && b.at(i) != 0 && b.at(i) != 2) {
      int g = 1;
      int t = b.at(i) / 2 - 1;
      int o = 1;
      while (t > 0) {
        g += mul(t + o) / mul(t) / mul(o);
        t--;
        o += 2;
      }
      ans *= g;
    } else if (b.at(i) % 2 == 1 && b.at(i) != 1) {
      int g = 1;
      int t = (b.at(i) - 1) / 2;
      int o = 0;
      while (t > 0) {
        g += mul(t + o) / mul(t) / mul(o);
        t--;
        o += 2;
      }
      ans *= g;
    }
  }
  cout << ans % 1000000007 << endl;
}
