#include <bits/stdc++.h>
using namespace std;
int main() {
  int mod = 1000000007;
  int n, m;
  vector<int> broken;
  vector<bool> status(n + 1, true);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int tmp;
    cin >> tmp;
    broken.push_back(tmp);
  }
  for (int i = 0; i < m; i++) {
    status[broken[i]] = false;
  }
  int steps = 0;
  int count = 1;
  while (steps < n) {
    if (steps < n - 1 && !status[steps + 1] && status[steps + 2]) {
      count *= 1;
      steps += 2;
    } else if (steps < n - 2 && status[steps + 1] && !status[steps + 2]) {
      count *= 1;
      steps += 3;
    } else if (steps == n - 1 && status[steps + 1]) {
      count *= 1;
      steps++;
    } else if (status[steps + 1] && status[steps + 2]) {
      count *= 2;
      steps += 2;
    } else {
      count = 0;
      break;
    }
  }
  cout << count % mod << endl;
  return 0;
}
