#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(M);
  for (int i = 0; i < (M); i++) {
    cin >> vec[i];
  }
  bool flag = true;
  for (int i = 0; i < (M - 1); i++) {
    if (vec[i] == vec[i + 1] - 1) {
      flag = false;
    }
  }
  vector<int> fib(N);
  fib[0] = 0;
  fib[1] = 1;
  for (int i = 2; i < N; i++) {
    fib[i] = fib[i - 2] + fib[i - 1];
  }
  int sum = 1;
  for (int i = 0; i < M; i++) {
    sum = fib[vec[i]] * sum;
  }
  sum = sum * (fib[N - vec[M - 1]]);
  sum = sum % 1000000007;
  if (flag == true) {
    cout << sum << endl;
  } else {
    cout << '0' << endl;
  }
}
