#include <bits/stdc++.h>
using namespace std;
int inf = (1 << 30);
int mod = 1e9 + 7;
int64_t inf64 = (1LL << 60);
template <typename T>
T gcd(T a, T b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  T g = gcd(a, b);
  return a / g * b;
}
bool check(vector<int> a, int index, int key) {
  if (a[index] >= key)
    return true;
  else
    return false;
}
int lower_bound(vector<int> a, int key) {
  int left = -1, right = a.size();
  while (right - left > 1) {
    int mid = left + (left + right) / 2;
    if (check(a, mid, key))
      right = mid;
    else
      left = mid;
  }
  return right;
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  for (int i = 0; i < M; i++) cin >> a[i];
  vector<int64_t> fib(N - M + 1);
  fib[0] = 0;
  fib[1] = 1;
  for (int i = 2; i < fib.size(); i++) fib[i] = fib[i - 1] + fib[i - 2];
  for (int i = 0; i < M - 1; i++) {
    if (a[i + 1] - a[i] == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  int state = 0;
  int64_t ans = 1;
  for (int i = 0; i < M; i++) {
    ans *= fib[a[i] - state];
    state = a[i] + 1;
    ans %= mod;
  }
  ans *= fib[N + 1 - state];
  ans %= mod;
  cout << ans << endl;
  return 0;
}
