#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  int A[M];
  for (int i = 0; i < M; ++i) cin >> A[i];
  long long int ans = 1;
  vector<int> LL;
  LL.push_back(0);
  for (int i = 0; i < M; ++i) {
    LL.push_back(A[i] - 1);
    LL.push_back(A[i] + 1);
  }
  LL.push_back(N);
  long long int S[1000001];
  S[0] = 1;
  S[1] = 1;
  for (int i = 2; i < 1000001; ++i) S[i] = (S[i - 1] + S[i - 2]) % 1000000007;
  for (int i = 0; i < LL.size() / 2 + 1; ++i) {
    ans *= S[LL.at(2 * i + 1) - LL.at(2 * i)];
    ans %= 1000000007;
  }
  for (int i = 1; i < M; ++i) {
    if (A[i] - A[i - 1] == 1) ans = 0;
  }
  cout << ans << endl;
}
