#include <bits/stdc++.h>
using namespace std;
long long int stair(long long int steps) {
  if (steps < 0) {
    return 0;
  }
  if (steps == 0) {
    return 0;
  }
  if (steps == 1) {
    return 1;
  }
  if (steps == 2) {
    return 2;
  }
  long long int ans = 0;
  ans += ((stair(steps - 1) % 1000000007) + (stair(steps - 2) % 1000000007));
  return ans % 1000000007;
}
int main() {
  long long int N, M;
  cin >> N >> M;
  vector<long long int> a(M);
  long long int ans = 1;
  long long int lacked = -1;
  bool flag = false;
  for (long long int i = 0; i < M; i++) {
    cin >> a.at(i);
    if (i > 0 && (a.at(i) - a.at(i - 1)) == 1) {
      ans = 0;
      flag = true;
    }
  }
  if (!flag) {
    for (long long int i = 0; i < M; i++) {
      if (a.at(i) == 1) {
        ans = 1;
        lacked = 1;
        continue;
      } else {
        if ((a.at(i) - lacked) == 2) {
          lacked = a.at(i);
          continue;
        } else {
          ans *= (stair(a.at(i) - (lacked + 2)));
          ans %= 1000000007;
          lacked = a.at(i);
        }
      }
    }
    if ((N - (lacked + 1)) > 0) {
      ans *= (stair(N - (lacked + 1)));
    }
  }
  cout << (ans % 1000000007) << endl;
}
