#include <bits/stdc++.h>
using namespace std;
long long fibonacci(int x) {
  int dp[10000] = {0};
  dp[0] = 0;
  dp[1] = 1;
  for (int i = 2; i < x; i++) {
    dp[i] = dp[i - 1] + dp[i - 2];
  }
  return dp[x];
}
int main() {
  bool isImpossible = false;
  const long DIV = 1000000007;
  int n, m;
  cin >> n >> m;
  int a[m + 1];
  for (int i = 1; i < m + 1; i++) {
    cin >> a[i];
  }
  a[0] = -1;
  for (int i = 1; i < m; i++) {
    if (a[i] + 1 == a[i + 1]) {
      isImpossible = true;
    }
  }
  if (isImpossible) {
    cout << 0 << endl;
  } else {
    long fibonacci[10000] = {0};
    fibonacci[0] = 0;
    fibonacci[1] = 1;
    for (int i = 2; i < 10001; i++) {
      fibonacci[i] = (fibonacci[i - 1] + fibonacci[i - 2]) % DIV;
    }
    vector<int> b;
    for (int i = 1; i < m + 1; i++) {
      b.push_back(a[i] - a[0] - 1);
    }
    b.push_back(n - a[m]);
    long temp = 1;
    for (int i = 0; i < b.size(); i++) {
      temp *= fibonacci[b[i]] % DIV;
    }
    cout << temp << endl;
  }
  return 0;
}
