#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, m, cnt = 1, zcnt = 0;
  long long ans = 1;
  cin >> N >> M;
  int a[N];
  for (int i = 0; i < N; i++) a[i] = 1;
  for (int i = 0; i < M; i++) {
    cin >> m;
    a[m - 1] = 0;
  }
  for (int i = 0; i < N; i++) {
    cnt++;
    if ((i == N - 1) && (cnt - 2 > 0)) {
      while (cnt - 2 > 0) {
        ans = ans * 2 % 1000000007;
        cnt--;
      }
      break;
    }
    if ((i == N - 1) && (cnt - 2 <= 0)) break;
    if (a[i] == 1) {
      zcnt = 0;
    } else {
      zcnt++;
      if (zcnt == 2) {
        ans = 0;
        break;
      } else {
        if (cnt - 3 > 0) {
          while (cnt - 3 > 0) {
            ans = ans * 2 % 1000000007;
            cnt--;
          }
        }
        cnt = 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
