#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;
}
int main() {
  long long int N, M;
  cin >> N >> M;
  vector<long long int> a(M);
  for (long long int i = 0; i < M; i++) {
    cin >> a.at(i);
  }
  long long int ans = 1;
  long long int lacked = -1;
  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;
      }
      if ((a.at(i) - lacked) == 1) {
        ans = 0;
        break;
      } else {
        ans *= (stair(a.at(i) - (lacked + 2)) % 1000000007);
        if (ans == 0) break;
        ans %= 1000000007;
        lacked = a.at(i);
      }
    }
  }
  if ((N - (lacked + 1)) > 0) {
    ans *= (stair(N - (lacked + 1)) % 1000000007);
  }
  cout << (ans % 1000000007) << endl;
}
