#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1000000007, N = 1e5 + 10;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll n, m;
  cin >> n >> m;
  vector<int> a(n + 1, 1);
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    a[x] = 0;
  }
  ll ans = 1;
  int i = 0;
  while (i < n - 1) {
    if (a[i + 1] == 1 and a[i + 2] == 1) {
      ans = ans * 2;
      ans = ans % MOD;
      i += 1;
    } else if (a[i + 1] == 1) {
      i += 1;
    } else if (a[i + 2] == 1) {
      i += 2;
    } else {
      cout << "0\n";
      return 0;
    }
  }
  cout << ans << "\n";
  return 0;
}
