#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000000 + 7;
int main() {
  ll n, m, t;
  cin >> n >> m;
  vector<int> a(n + 1, 0);
  for (int i = 0; i < m; i++) {
    cin >> t;
    a.at(t) = -1;
  }
  for (int i = 1; i < n + 1; i++) {
    if (a.at(i - 1) == -1 && a.at(i) == -1) {
      cout << 0 << endl;
      return 0;
    }
  }
  ll ans = 1;
  for (int i = 0; i < n; i++) {
    if (i + 2 < n + 1 && a.at(i + 2) == 0 && a.at(i + 1) == 0) {
      ans *= 2;
    }
    if (ans >= mod) ans %= mod;
  }
  cout << ans << endl;
}
