#include <bits/stdc++.h>
using namespace std;
long long UNIT = 1000000007;
int main() {
  int N, M;
  cin >> N >> M;
  vector<bool> broken(N, false);
  for (int i = 0; i < M; i++) {
    int tmp;
    cin >> tmp;
    broken[tmp] = true;
  }
  long long count = 1;
  for (int i = 2; i <= N; i += 2) {
    bool c1 = broken[i - 1];
    bool c2 = broken[i - 2];
    if (c1 && c2) {
      cout << 0 << endl;
      return 0;
    } else if ((!c1) && (!c2)) {
      count *= 2;
      count %= UNIT;
    }
  }
  cout << count << endl;
}
