#include <bits/stdc++.h>
using namespace std;
long long int memo[100000];
long long int f(int n) {
  if (n <= 1) return 1;
  if (memo[n] != 0) return (memo[n] % 1000000007);
  return memo[n] = (f(n - 1) % 1000000007) + (f(n - 2) % 1000000007);
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  for (int i = 0; i < M; i++) cin >> a[i];
  for (int i = 0; i < M - 1; i++) {
    if (M >= 2 && a[i + 1] - a[i] <= 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  long long int ans = 1;
  for (int i = 0; i < M; i++) {
    if (i == 0) {
      ans *= (f(a[0] - 1) % 1000000007);
    } else {
      ans *= (f(a[i] - a[i - 1] - 2) % 1000000007);
    }
  }
  ans *= (f(N - a[M - 1] - 1) % 1000000007);
  cout << ans % 1000000007 << endl;
}
