#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  int minDis = 10e6, maxDis = -1, tmp = 0;
  vector<int> As(M);
  for (int i = 0; i < M; ++i) {
    cin >> As[i];
    if (i == 0) {
      tmp = As[i];
    } else {
      if ((tmp + 1) == As[i]) {
        cout << 0 << endl;
        return 0;
      }
      tmp = As[i];
    }
  }
  vector<int> dist(M + 1);
  dist[0] = As[0] - 2;
  if (As[0] == 1 || As[0] == 2) {
    dist[0] = 0;
  }
  for (int i = 1; i < M; ++i) {
    dist[i] = As[i] - As[i - 1] - 2;
  }
  dist[M] = N - As[M - 1] - 2;
  maxDis = *max_element(dist.begin(), dist.end());
  vector<int> table(maxDis);
  table[0] = 1;
  table[1] = 2;
  table[2] = 3;
  for (int i = 3; i < maxDis; ++i) {
    table[i] = table[i - 2] + table[i - 1] + 1;
  }
  long long ans = 1;
  for (int i : dist) {
    ans *= table[i];
    ans %= (long long)1000000007;
  }
  cout << ans << endl;
  return 0;
}
