#include <bits/stdc++.h>
using namespace std;
int main() {
  long N, M, cnt, C;
  cin >> N >> M;
  bool streak = 0;
  vector<long> vec(M + 1);
  for (long i = 0; i < M; i++) {
    cin >> vec[i];
    if (i == 0)
      C = vec[i] - 1;
    else {
      if (vec[i] - vec[i - 1] == 1) streak = 1;
      cnt = vec[i] - vec[i - 1] - 1;
      C = max(C, cnt);
    }
  }
  vec[M] = N;
  if (streak)
    cout << 0 << endl;
  else {
    vector<long long> fib(C);
    fib[0] = 1, fib[1] = 1;
    for (long j = 2; j < C; j++) {
      fib[j] = fib[j - 1] + fib[j - 2];
    }
    vector<long long> v(C + 1);
    v[0] = 1;
    for (long k = 1; k < C + 1; k++) {
      v[k] = v[k - 1] + fib[k - 1];
    }
    vector<long long> answer(M + 1);
    if (v[vec[0]] > 2)
      answer[0] = v[vec[0] - 2];
    else
      answer[0] = 1;
    for (long l = 1; l < M + 1; l++) {
      if (v[vec[l] - vec[l - 1]] > 2)
        answer[l] = v[vec[l] - vec[l - 1] - 2];
      else
        answer[l] = 1;
    }
    long long ans = answer[0];
    for (long m = 1; m < M + 1; m++) {
      ans *= answer[m];
      if (ans > 1000000007) ans %= 1000000007;
    }
    cout << ans << endl;
  }
}
