#include <bits/stdc++.h>
using namespace std;
long long gcd(long long s, long long b) {
  if (b == 0) return s;
  return gcd(b, s % b);
}
signed main() {
  long long n, m;
  cin >> n >> m;
  long long a[m];
  for (long long i = 0; i < m; i++) {
    cin >> a[i];
  }
  long long dp[n + 1];
  dp[0] = 1;
  dp[1] = 1;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  } else {
    for (long long i = 2; i < n + 1; i++) {
      dp[i] = dp[i - 1] + dp[i - 2];
    }
  }
  long long ans = 0, kai = 1;
  for (long long i = 0; i < m; i++) {
    if (a[i] - 1 - ans < 0) {
      cout << 0 << endl;
      return 0;
    }
    kai = kai * dp[a[i] - 1 - ans] % 1000000007;
    ans = a[i] + 1;
  }
  kai = kai * dp[n - ans] % 1000000007;
  cout << kai << endl;
}
