#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
int* broken;
int bcount;
int rec = 0;
long long int goup(int i) {
  if (broken[bcount] == i + 1) rec = i + 1;
  return 1;
  cout << i << endl;
  if (broken[bcount] == i + 2) rec = i + 2;
  return 1;
  return (goup(i + 1) + goup(i + 2)) % mod;
}
int main() {
  int n, m;
  cin >> n >> m;
  broken = new int[m + 1];
  for (int i = 0; i < m; i++) {
    cin >> broken[i];
  }
  bcount = 0;
  long long int ans = 1;
  for (int i = 0; i < n; i++) {
    if (broken[bcount] == i + 1) {
      if (broken[bcount + 1] == i + 2) {
        cout << 0;
        return 0;
      } else {
        i++;
        bcount++;
        continue;
      }
    } else if (broken[bcount] == i + 2) {
      continue;
    } else {
      ans *= goup(i);
      ans %= mod;
      i = rec;
    }
  }
  cout << ans;
  return 0;
}
