#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n, m;
  cin >> n >> m;
  map<int, int> mp;
  mp[0] = 1;
  for (int i = 1; i < n + 1; i++) {
    mp[i] = 1;
  }
  int k;
  for (int i = 0; i < m; i++) {
    cin >> k;
    mp[k] = 0;
  }
  ll ans = 1;
  ll mod = 1000000007;
  for (int i = 2; i < n; i++) {
    if (mp[i - 2] == 0 && mp[i - 1] == 0) {
      cout << 0 << endl;
      return 0;
    } else if (mp[i - 2] == 1 && mp[i - 1] == 1) {
      ans = (ans * 2) % mod;
    } else {
      ans *= 1;
    }
  }
  cout << ans << endl;
  return 0;
}
