#include <bits/stdc++.h>
using namespace std;
vector<long long> fibo(long long N) {
  long long i;
  vector<long long> A(N);
  A[0] = 1;
  A[1] = 2;
  for (i = 2; i < N; i++) {
    A[i] = (A[i - 1] + A[i - 2]) % 1000000007;
  }
  return A;
}
int main() {
  long long i;
  long long N, M;
  long long one_count = 0;
  long long result = 1;
  cin >> N >> M;
  vector<long long> A(M);
  vector<long long> B(M + 1);
  vector<long long> fibo_B;
  for (i = 0; i < M; i++) {
    cin >> A[i];
    if (i == 0) {
      B[0] = A[i] - 1;
    } else {
      if (A[i] - A[i - 1] == 1) {
        one_count += 1;
      }
      B[i] = A[i] - A[i - 1] - 2;
    }
  }
  if (one_count > 0) {
    cout << 0 << endl;
  } else {
    B[i] = N - A[i - 1] - 1;
    sort(B.begin(), B.end());
    fibo_B = fibo(B[M]);
    for (i = 0; i < M + 1; i++) {
      if (B[i] != 0) {
        result *= fibo_B[B[i] - 1];
      }
      result = result % 1000000007;
    }
    cout << result << endl;
  }
}
