#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m, a, b = -10;
  cin >> n >> m;
  bool t = true;
  long long int ans = 0;
  for (int i = 0; i < m; i++) {
    cin >> a;
    if (b + 1 == a) {
      t = false;
      break;
    }
    b = a;
  }
  if (t) {
    long long int s = pow(2, (n - 2 * m) / 2);
    ans = s % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
