#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> broken(m);
  for (int i = 0; i < m; i++) {
    cin >> broken[i];
  }
  broken.push_back(0);
  int idx = 0;
  int mul = 2, sum = 1;
  bool jump = false;
  for (int i = 0; i < n; i++) {
    if (jump) {
      jump = false;
      idx++;
      continue;
    }
    if (i + 1 == broken[idx]) {
      mul--;
      jump = true;
    }
    if (mul == 1) {
      if (i + 2 == broken[idx + 1]) {
        cout << 0 << endl;
        return 0;
      }
    } else if (i + 2 == broken[idx])
      mul--;
    if (i == n - 1) mul = 1;
    sum = sum * mul;
    if (sum - 1000000007 > 0) sum -= 1000000007;
    mul = 2;
  }
  cout << sum << endl;
}
