#include <bits/stdc++.h>
using namespace std;
template <typename T>
void Show(const vector<vector<T>>& v, string delimiter = " ") {
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0; j < v[i].size(); j++) {
      cout << v[i][j];
      if (j != v[i].size() - 1) {
        cout << delimiter;
      } else {
        cout << endl;
      }
    }
  }
}
template <typename T>
void Show(const vector<T>& v, string delimiter = " ") {
  for (int i = 0; i < v.size(); i++) {
    cout << v[i];
    if (i != v.size() - 1) {
      cout << delimiter;
    } else {
      cout << endl;
    }
  }
}
template <typename T>
vector<T> getUniform(T value, int n) {
  vector<vector<T>> ts;
  ts.resize(n);
  for (int i = 0; i < n; i++) {
    ts[i] = value;
  }
  return ts;
}
template <typename T>
vector<vector<T>> getUniform(T value, int row, int col) {
  vector<vector<T>> ts;
  ts.resize(row);
  for (int i = 0; i < row; i++) {
    ts[i].resize(col);
    for (int j = 0; j < col; j++) {
      ts[i][j] = value;
    }
  }
  return ts;
}
bool All(vector<vector<bool>> ts) {
  int h = ts.size();
  int w = ts[0].size();
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++)
      if (!ts[i][j]) return false;
  return true;
}
vector<string> split(string& content, char delim) {
  auto ss = vector<string>();
  string s = "";
  for (size_t i = 0; i < content.length(); i++) {
    if (content[i] == delim) {
      ss.push_back(s);
      s = "";
      continue;
    }
    s += content[i];
  }
  if (s != "") ss.push_back(s);
  return ss;
}
vector<long long> steps;
long long calc_step(int n) {
  if (n == 0) return 1;
  if (steps[n] != 0) return steps[n];
  steps[n] = calc_step(n - 1) + calc_step(n - 2);
  return steps[n];
}
int main() {
  int N, M;
  cin >> N >> M;
  auto spaces = vector<int>(M + 1);
  steps = vector<long long>(N);
  steps[1] = 1;
  steps[2] = 2;
  int current = 0;
  int sp;
  for (int i = 0; i < M; i++) {
    cin >> sp;
    spaces[i] = (sp - 1) - current;
    if (spaces[i] < 0) {
      cout << 0 << endl;
      return 0;
    }
    current = sp + 1;
  }
  spaces[M] = (sp == N - 1) ? 1 : N - current;
  long long answer = 1;
  for (auto s : spaces) {
    answer *= calc_step(s);
    answer %= 1000000007;
  }
  cout << answer << endl;
  return 0;
}
