#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  cin >> a.at(0);
  for (int i = 1; i < M; i++) {
    cin >> a.at(i);
    if (a.at(i) - a.at(i - 1) == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  int now = 0;
  long long int ans = 1;
  vector<int> fibonacci(100000);
  fibonacci[0] = 0;
  fibonacci[1] = 1;
  fibonacci[2] = 1;
  for (int i = 3; i <= 100000; i++) {
    fibonacci[i] = (fibonacci[i - 1] + fibonacci[i - 2]) % 1000000007;
  }
  for (int i = 0; i < M; i++) {
    int diff = a.at(i) - now;
    ans = (ans * fibonacci.at(diff)) % 1000000007;
    now = a.at(i) + 1;
  }
  ans = (ans * fibonacci.at(N - a.at(M - 1))) % 1000000007;
  cout << ans << endl;
  return 0;
}
