#include <bits/stdc++.h>
using namespace std;
int a(int x) {
  if (x == 0 || x == 1) {
    return 1;
  } else if (x == 2) {
    return 2;
  } else {
    vector<int> b(x);
    b[0] = 1;
    b[1] = 2;
    for (int i = 2; i < x; i++) {
      b[i] = b[i - 1] + b[i - 2];
    }
    return b[x - 1];
  }
}
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;
}
