#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll N, M;
  cin >> N >> M;
  vector<ll> a(M), DP(N + 3);
  for (auto&& i : a) {
    cin >> i;
  }
  DP.at(0) = 1;
  a.push_back(N + 2);
  a.push_back(N + 2);
  ll koetayuka{};
  for (ll now{0}; now < N; now++) {
    auto& tsugi = a.at(koetayuka);
    auto& sonotsugi = a.at(koetayuka + 1);
    if (now + 1 == tsugi && now + 2 == sonotsugi) {
    } else if (now + 1 == tsugi) {
      DP.at(now + 2) += DP.at(now);
      koetayuka++;
    } else if (now + 2 == tsugi) {
      DP.at(now + 1) += DP.at(now);
    } else {
      DP.at(now + 2) += DP.at(now);
      DP.at(now + 1) += DP.at(now);
    }
  }
  cout << DP.at(N) % 1000000007 << "\n";
}
