#include <bits/stdc++.h>
using namespace std;
void comb(vector<vector<uint64_t> > &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() {
  int N, M;
  int am[100000];
  std::cin >> N >> M;
  int none = 0;
  if (M != 0) {
    std::cin >> am[0];
  }
  for (int i = 1; i < M; i++) {
    std::cin >> am[i];
    if (am[i - 1] == am[i] - 1) {
      none = 1;
    }
  }
  if (none == 1) {
    std::cout << 0 << std::endl;
    return 0;
  }
  am[M] = N + 1;
  M = M + 1;
  uint64_t retnum = 1;
  int pre = 0;
  for (int i = 0; i < M; i++) {
    int temp = am[i] - pre - 1;
    if (temp > 1) {
      uint64_t bufnum = 1;
      temp -= 2;
      for (int j = 1;; j++) {
        if (temp == 0) {
          bufnum++;
        } else {
          vector<vector<uint64_t> > v(temp + j + 1,
                                      vector<uint64_t>(temp + j + 1, 0));
          comb(v);
          bufnum += v[temp + j][j];
        }
        temp -= 2;
        if (temp < 0) {
          break;
        }
      }
      retnum *= bufnum;
    }
    pre = am[i] + 1;
  }
  retnum = retnum % 1000000007;
  std::cout << retnum << std::endl;
}
