#include <bits/stdc++.h>
int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  unsigned long long ans = 0;
  int N, M;
  std::cin >> N >> M;
  std::vector<int> a;
  for (int(i) = 0; (i) < (M); (i)++) {
    int tmp;
    std::cin >> tmp;
    a.push_back(tmp);
  }
  int current = 0;
  bool flag = false;
  while (current <= N) {
    auto plus1 = std::find(a.begin(), a.end(), current + 1);
    auto plus2 = std::find(a.begin(), a.end(), current + 2);
    if (plus1 == a.end() && plus2 == a.end()) {
      if (ans == 0)
        ans = 2;
      else
        ans *= 2;
      current += 2;
    } else if (plus1 == a.end()) {
      current++;
    } else if (plus2 == a.end()) {
      current += 2;
    } else {
      flag = true;
      std::cout << 0;
      break;
    }
    ans %= 1000000007;
  }
  if (!flag) std::cout << ans;
  return 0;
}
