#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> aV(n + 1, 0);
  {
    int a = 0;
    for (int i = 0; i < m; ++i) {
      cin >> a;
      aV[a] = 1;
    }
  }
  unsigned long long ret = 1LL;
  for (int i = 0; i < n - 1; ++i) {
    if (aV[i + 2] || aV[i + 1] || aV[i]) {
      if (aV[i + 2] && aV[i + 1]) {
        ret = 0LL;
        break;
      }
      continue;
    }
    ret = (ret * 2LL) % 1000000007LL;
  }
  cout << ret << endl;
  return 0;
}
