#include <bits/stdc++.h>
using namespace std;
int64_t MOD = pow(10, 9) + 7;
int64_t MAX = LONG_MAX;
int64_t MIN = LONG_MIN;
int64_t gcd(int64_t a, int64_t b) { return b != 0 ? gcd(b, a % b) : a; }
int64_t lcm(int64_t a, int64_t b) { return a * b / gcd(a, b); }
int ctoi(char c) { return c - '0'; }
int64_t dp[100010];
int main() {
  int64_t n, m;
  cin >> n >> m;
  vector<int64_t> a(m);
  for (int64_t i = 0; i < (a).size(); i++) {
    cin >> (a).at(i);
  };
  for (int64_t i = 0; i < (m); i++) {
    if (i == 0) continue;
    if (a.at(i) - 1 == a.at(i - 1)) {
      cout << 0 << endl;
      return 0;
    }
  }
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  dp[0] = 1;
  dp[1] = 1;
  dp[2] = 2;
  for (int64_t i = 0; i < (100010); i++) {
    if (i == 0) continue;
    if (i == 1) continue;
    if (i == 2) continue;
    dp[i] = dp[i - 1] + dp[i - 2];
  }
  int64_t t = 0;
  for (int64_t i = 0; i < (m); i++) {
    if (i == 0) {
      if (a.at(i) == 1) {
        t = 1;
      } else {
        t = dp[a.at(i) - 1] % MOD;
      }
    }
    if (i >= m - 1) {
      t = (t * dp[n - a.at(i) - 1]) % MOD;
    } else {
      t = (t * dp[a.at(i + 1) - a.at(i) - 2]) % MOD;
    }
  }
  cout << t << endl;
  return 0;
}
