#include <bits/stdc++.h>
long long int MOD = 1000000007;
using namespace std;
long long int fib[10000];
long long int getFib(int k) {
  if (k == 0) return 0;
  if (k == 1) return 1;
  if (k == 2) return 2;
  if (fib[k] != 0) return fib[k];
  return fib[k] = (getFib(k - 1) + getFib(k - 2)) % MOD;
}
int main() {
  int n, m;
  long long int sum = 1;
  cin >> n >> m;
  int a[m + 2];
  for (int i = 1; i < m + 1; i++) {
    cin >> a[i];
    if (i > 1 && a[i] == a[i - 1] + 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  a[0] = 0;
  a[m + 1] = n;
  for (int i = 0; i < n; i++) {
    fib[i] = 0;
  }
  for (int i = 0; i < m + 1; i++) {
    if (a[i + 1] - a[i] - 1 != 0) {
      sum = ((sum % MOD) * (getFib(a[i + 1] - a[i] - 1) % MOD)) % MOD;
    }
  }
  cout << sum << endl;
}
