#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int mod = 1000000007;
int main() {
  int n, m;
  cin >> n >> m;
  int a[m];
  for (int i = int(0); i < int(m); ++i) cin >> a[i];
  int cur = 0;
  int isOK = 1;
  long long ans = 1;
  for (int i = int(0); i < int(m - 1); ++i) {
    if (a[i + 1] - a[i] == 1) {
      isOK = 0;
      break;
    }
  }
  int fib[100001];
  fib[0] = 1;
  fib[1] = 1;
  fib[2] = 2;
  for (int i = int(0); i < int(99999); ++i)
    fib[i + 3] = fib[i + 2] + fib[i + 1];
  if (isOK) {
    for (int i = int(0); i < int(m); ++i) {
      ans *= fib[a[i] - 1 - cur] % mod;
      ans %= mod;
      cur = a[i] + 1;
    }
    ans *= fib[n - cur] % mod;
    ans %= mod;
    cout << ans << endl;
  } else
    cout << 0 << endl;
}
