#include <bits/stdc++.h>
using namespace std;
long long r[100001];
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  vector<int> d(M + 1);
  for (int i = 0; i < M; i++) {
    cin >> a[i];
  }
  int maxv = a[0];
  d[0] = a[0] - 1;
  for (int i = 1; i < M; i++) {
    d[i] = a[i] - a[i - 1] - 2;
    if (d[i] == -1) {
      cout << 0 << endl;
      return 0;
    }
    maxv = max(maxv, d[i]);
  }
  d[M] = N - a[M - 1] - 1;
  maxv = max(maxv, d[M]);
  r[0] = 1;
  r[1] = 1;
  for (int i = 2; i < maxv + 2; i++) {
    r[i] = (r[i - 1] + r[i - 2]) % 1000000007;
  }
  long long ans = 1;
  for (int i = 0; i < M + 1; i++) {
    ans = (ans * r[d[i]]) % 1000000007;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
