#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, M, A, h = -1;
  cin >> N >> M;
  vector<bool> a(N, false);
  for (int i = 0; i < M; i++) {
    cin >> A;
    a[A - 1] = true;
    a[A] = true;
    a[A + 1] = true;
    if (h + 1 == A) {
      cout << 0 << endl;
      return 0;
    }
    h = A;
  }
  long long ans = 1;
  for (int i = 1; i < N; i++) {
    if (!a[i]) {
      ans *= 2;
      ans %= 100000000007;
    }
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
