#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  vector<int> a(10000);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> a[i];
  long long t = 1;
  for (int i = 0; i <= n - 1;) {
    if (i != n - 1) {
      vector<int>::iterator it;
      vector<int>::iterator ti;
      it = find(a.begin(), a.end(), i + 2);
      ti = find(a.begin(), a.end(), i + 1);
      if (it != a.end() && ti == a.end()) {
        i++;
        continue;
      } else if (ti != a.end() && it == a.end()) {
        i += 2;
        continue;
      } else if (it == a.end() && ti == a.end()) {
        i += 2;
        t *= 2;
        continue;
      } else if (it != a.end() && ti != a.end()) {
        t = 0;
        break;
      }
    }
    if (i == n - 1) i++;
  }
  cout << t % 1000000007 << endl;
  return 0;
}
