#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  for (int i = 0; i < M; i++) {
    cin >> a.at(i);
  }
  vector<int> b(M + 1);
  for (int i = 0; i < M + 1; i++) {
    if (i == 0) {
      b.at(i) = a.at(i) - 1;
    } else if (i == M) {
      b.at(i) = N - a.at(M - 1) - 1;
    } else {
      b.at(i) = a.at(i) - a.at(i - 1) - 1;
    }
  }
  int64_t S = 1LL;
  for (int i = 0; i < M + 1; i++) {
    if ((i != 0 && i != M) && b.at(i) == 0) {
      cout << 0 << endl;
      break;
    }
    int64_t c, d, e;
    for (int j = 0; j < b.at(i); j++) {
      if (j == 0) {
        c = 1;
      } else if (j == 1) {
        d = c;
        c = 2;
      } else {
        e = d;
        d = c;
        c = d + e;
      }
    }
    if (b.at(i) == 0) {
      c = 1;
    }
    S *= c;
    if (i == M) {
      cout << S % 1000000007 << endl;
    }
  }
}
