#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; i++) cin >> a[i];
  for (int i = 0; i < m - 1; i++) {
    if (a[i] == a[i + 1]) {
      cout << 0 << endl;
      return 0;
    }
  }
  vector<long long> dp(n + 1);
  dp[0] = 1;
  dp[1] = 1;
  int j = 0;
  for (int i = 2; i < dp.size(); i++) {
    if (a[j] == i) {
      dp[i] = 0;
      j++;
      continue;
    }
    if (a[j] == i - 1) {
      dp[i] = dp[i - 2];
      j++;
    } else {
      dp[i] = dp[i - 1] + dp[i - 2];
    }
  }
  cout << dp[n] % 1000000007 << endl;
  return 0;
}
