#include <bits/stdc++.h>
using namespace std;
using lint = long long;
lint p(lint n, lint a) {
  lint sum = 1;
  for (int i = 0; i < a; i++) {
    sum *= (n - i);
  }
  for (int i = a; i >= 1; i--) {
    sum /= i;
  }
  return sum;
}
int main(void) {
  int N, M;
  cin >> N >> M;
  vector<int> a(M + 1);
  for (int i = 0; i < M; i++) {
    cin >> a[i];
  }
  a[M] = N + 1;
  for (int i = 1; i < M + 1; i++) {
    if (a[i] - a[i - 1] == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  lint sum_all = 1;
  lint last = 0;
  for (int i = 0; i < M + 1; i++) {
    lint sum = 0;
    lint step = a[i] - 1;
    lint num = step - last;
    for (int j = 0;; j++) {
      sum += p(num - j, j) % 1000000007;
      if (num - j * 2 <= 1) {
        break;
      }
    }
    last = a[i] + 1;
    sum_all *= sum % 1000000007;
    sum_all %= 1000000007;
  }
  cout << sum_all << endl;
  return 0;
}
