#include <bits/stdc++.h>
using namespace std;
long num(int n) {
  if (n < 0) {
    return -1;
  }
  long current = 0;
  long next = 1;
  for (int i = 0; i < n; i++) {
    long tmp = current;
    current = next;
    next += tmp;
  }
  return current;
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M + 2);
  a.at(0) = -1;
  for (int i = 1; i < M + 1; i++) {
    cin >> a.at(i);
  }
  a.at(M + 1) = N + 1;
  int64_t ans = 1;
  int st;
  int flag = 1;
  for (int i = 0; i < M + 1; i++) {
    if (a.at(i + 1) - a.at(i) == 1) {
      flag = 0;
    }
  }
  if (flag) {
    for (int i = 0; i < M + 1; i++) {
      st = a.at(i + 1) - a.at(i) - 2;
      ans *= num(st + 1);
      ans %= 1000000007;
    }
  } else {
    ans = 0;
  }
  cout << ans << endl;
  return 0;
}
