#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M + 2);
  long long int ans = 0;
  a[0] = -1;
  for (int i = (1); i < (M + 1); i++) {
    cin >> a[i];
  }
  a[M + 1] = N + 1;
  bool canClimb = true;
  for (int i = (1); i < (M); i++) {
    if (a[i] + 1 == a[i + 1]) {
      canClimb = false;
    }
  }
  if (canClimb) {
    ans = 1;
    for (int i = (1); i < (M + 2); i++) {
      int dan = a[i] - a[i - 1] - 2;
      long long int k, l, tmp;
      k = 1;
      l = 1;
      if (dan != 0 && dan != 1) {
        while (dan > 1) {
          tmp = k + l;
          k = l;
          l = tmp;
          dan--;
        }
      }
      ans = (ans * l) % 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
