#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
using vi = vector<int>;
void absll(ll &x) {
  if (x >= 0)
    return;
  else
    x = -x;
  return;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1LL << 60;
int N, M;
vector<ll> a(100010);
vector<ll> dp(100010);
ll rec(int i) {
  if (i == 0) return dp.at(0) = 1;
  if (i == 1) return dp.at(1) = 1;
  if (dp.at(i) < INF) return dp.at(i);
  ll res;
  res = rec(i - 1) + rec(i - 2);
  res %= 1000000007;
  return dp.at(i) = res;
}
int main() {
  cin >> N >> M;
  for (int i = 0; i < (int)M; i++) cin >> a.at(i);
  if (M > 1) {
    for (int j = 0; j < (int)M; j++) {
      if (a.at(j) + 1 == a.at(j + 1)) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  for (int i = 0; i < (int)N + 1; i++) dp.at(i) = INF;
  ll sum;
  for (int i = 0; i < (int)M; i++) {
    if (i == 0)
      sum = rec(a.at(i) - 1);
    else
      sum *= rec(a.at(i) - 2 - a.at(i - 1));
  }
  sum *= rec(N - 1 - a.at(M - 1));
  cout << sum % 1000000007 << endl;
}
