#include <bits/stdc++.h>
using namespace std;
int a(int x) {
  vector<int> b;
  b.resize(x + 1);
  b.at(0) = 1;
  b.at(1) = 1;
  b.at(2) = 2;
  if (x > 2) {
    for (int i = 3; i < x + 1; i++) {
      b.at(i) = b.at(i - 1) + b.at(i - 2);
    }
  }
  return b.at(x);
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> c;
  c.resize(M);
  for (int i = 0; i < M; i++) {
    cin >> c.at(i);
  }
  int wa = a(c.at(0) - 1) * a(N - c.at(M - 1) - 1);
  for (int i = 0; i < M - 1; i++) {
    if (c.at(i + 1) == c.at(i) + 1) {
      wa = 0;
      break;
    } else if (c.at(i + 1) == c.at(i) + 2) {
      wa *= 1;
    } else {
      wa *= a(c.at(i + 1) - c.at(i) - 2);
    }
  }
  if (wa != 0) {
    wa = wa % 1000000007;
  }
  cout << wa << endl;
}
