#include <bits/stdc++.h>
int calcComb(int pre, int post) {
  int temp = pre;
  int temppost = pre - post;
  if (temppost < post) {
    post = temppost;
  }
  for (int k = 1; k < post; k++) {
    temp = temp * (pre - k);
  }
  for (int k = post; k > 1; k--) {
    temp = temp / k;
  }
  return temp;
}
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 {
          bufnum += calcComb(temp + j, j);
        }
        temp -= 2;
        if (temp < 0) {
          break;
        }
      }
      retnum *= bufnum;
    }
    pre = am[i] + 1;
  }
  retnum = retnum % 1000000007;
  std::cout << retnum << std::endl;
}
