#include <bits/stdc++.h>
using namespace std;
long long int C(int n, int i) {
  if (n - i < i) i = n - i;
  if (i == 0) return 1;
  long long int ans1 = 1;
  long long int ans2 = 1;
  for (int j = 0; j < i; j++) {
    ans1 *= n - j;
    ans2 *= j + 1;
  }
  return ans1 / ans2;
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> c;
  for (int i = 0; i < M; i++) {
    cin >> a.at(i);
    if (i == 0) {
      c.push_back(a.at(i) - 1);
    }
    if (i > 0) {
      if (a.at(i) - 1 == a.at(i - 1)) {
        cout << 0 << endl;
        return 0;
      } else {
        c.push_back(a.at(i) - a.at(i - 1) - 1);
      }
    }
    if (i == M - 1) {
      c.push_back(N - a.at(i) - 1);
    }
  }
  long long int tmp = 0;
  long long int ans = 1;
  for (int i = 0; i < c.size(); i++) {
    if (c.at(i) > 1) {
      tmp = 0;
      for (int j = 0; j <= c.at(i) / 2; j++) {
        if (j == 0) {
          tmp++;
        } else {
          tmp += C(j + c.at(i) - 2 * j, j);
        }
      }
      ans *= tmp;
    }
  }
  ans = ans % 1000000007;
  cout << ans << endl;
}
