#include <bits/stdc++.h>
using namespace std;
int fibonacci(int n) {
  switch (n) {
    case 0:
      return 0;
    case 1:
      return 1;
    default:
      return fibonacci(n - 2) + fibonacci(n - 1);
  }
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(M);
  for (int i = 0; i < M; i++) {
    cin >> vec.at(i);
  }
  int sum = 1;
  bool p = false;
  for (int i = 0; i < M - 1; i++) {
    if (vec.at(i + 1) - vec.at(i) == 1) {
      p = true;
      break;
    }
    sum *= fibonacci(vec.at(i + 1) - vec.at(i) - 1);
  }
  sum *= fibonacci(vec.at(0));
  sum *= fibonacci(N - vec.at(M - 1));
  if (!p) {
    cout << sum % 1000000007 << endl;
  } else {
    cout << 0 << endl;
  }
}
