#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<long long int> s(M + 2), t(N), d(M + 1);
  s[0] = -1;
  for (int i = 1; i < M + 1; ++i) {
    cin >> s[i];
  }
  s[M + 1] = N + 1;
  t[0] = 1;
  t[1] = 1;
  for (int i = 1; i < M + 1; ++i) {
    d[i] = s[i] - s[i - 1];
  }
  int max_d = *max_element(d.begin(), d.end());
  int min_d = *min_element(d.begin(), d.end());
  if (min_d <= 1 && d[0] != 1 && d[0] != 0) {
    cout << 0 << endl;
  } else {
    for (int i = 2; i < max_d; ++i) {
      t[i] = t[i - 1] + t[i - 2];
      t[i] = t[i] % 1000000007;
    }
    long long int sum = 1;
    for (int i = 1; i < M + 1; ++i) {
      sum = sum * t[d[i] - 2];
      sum = sum % 1000000007;
    }
    cout << sum % 1000000007 << endl;
  }
}
