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