#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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 (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INF = 1LL << 60;
ll gcd(ll a, ll b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
uintmax_t combination(unsigned int n, unsigned int r) {
  if (r * 2 > n) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor = 1;
  for (unsigned int i = 1; i <= r; ++i) {
    dividend *= (n - i + 1);
    divisor *= i;
  }
  return dividend / divisor;
}
int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll memo[1000010];
ll fib(ll x) {
  if (x == 0)
    return 1;
  else if (x <= 2)
    return x;
  else if (memo[x] != 0)
    return memo[x];
  return memo[x] = fib(x - 2) + fib(x - 1);
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0, i_len = (m); i < i_len; ++i) cin >> a[i];
  ll ans = 1;
  sort((a).begin(), (a).end());
  if (m > 1) {
    for (int i = 0, i_len = (m - 1); i < i_len; ++i) {
      if (a[i] + 1 == a[i + 1]) {
        ans = 0;
        break;
      }
    }
  }
  if (ans != 0) {
    vector<int> kai(n, 1);
    for (int i = 0, i_len = (m); i < i_len; ++i) {
      kai[a[i] - 1] = 0;
    }
    vector<int> group(1, 0);
    for (int i = 0, i_len = (n); i < i_len; ++i) {
      if (kai[i] == 1)
        group.back()++;
      else
        group.push_back(0);
    }
    group[m]--;
    for (int i = 0, i_len = (m + 1); i < i_len; ++i) ans *= fib(group[i]);
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
