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