#include <bits/stdc++.h>
using namespace std;
bool isFind(int a[], int m, int num) {
  for (int i = 0; i < m; i++) {
    if (num == a[i]) {
      return true;
    }
  }
  return false;
}
int main() {
  int n, m;
  cin >> n >> m;
  int broken[m];
  for (int i = 0; i < m; i++) {
    cin >> broken[i];
  }
  long sum = 1;
  for (int i = 1; i <= n; i++) {
    if (i == 1) {
      continue;
    }
    if (isFind(broken, m, i)) {
      if (isFind(broken, m, i - 1)) {
        cout << 0 << endl;
        return 0;
      }
      continue;
    }
    if (!isFind(broken, m, i - 1) && !isFind(broken, m, i - 2)) {
      sum *= 2;
    }
  }
  cout << (sum % 1000000007) << endl;
  return 0;
}
