#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long inf = 3e18 + 5;
const int maxn = 1e5;
int dp[maxn + 1];
int mult(int a, int b) { return 1LL * a * b % mod; }
int f(int n) {
  if (n == 1) return 2;
  if (n == 2) return 3;
  if (dp[n] != -1) return dp[n];
  return dp[n] = f(n - 1) + f(n - 2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  memset(dp, -1, sizeof(dp));
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  vector<int> b(1);
  bool check = true;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    if (i > 0) {
      if (a[i] - a[i - 1] == 1) {
        check = false;
        break;
      }
      b.push_back(a[i] - a[i - 1] - 3);
    }
    if (i == 0) b.push_back(a[i] - 2);
  }
  if (a.size()) {
    b.push_back(n - a.back() - 1);
    b.back()--;
  } else
    b.push_back(n);
  cout << endl;
  int sol = 1;
  for (int i = 0; i < b.size(); i++) {
    if (b[i] > 0) sol = mult(sol, f(b[i]));
  }
  if (check)
    cout << sol;
  else
    cout << 0;
}
