#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
long long step(int n) {
  if (n == 0 || n == 1) return 1;
  if (n == 2) return 2;
  return (step(n - 1) + step(n - 2)) % mod;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i);
    if (i == 0) continue;
    if (a.at(i) - a.at(i - 1) == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  long long cnt = 1;
  cnt *= step(a.at(0) - 1);
  for (int i = 1; i < m; i++) {
    cnt *= step(a.at(i) - a.at(i - 1) - 2);
    cnt %= mod;
  }
  cnt *= step(n - a.at(m - 1) - 1);
  cnt %= mod;
  cout << cnt << endl;
}
