#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int main() {
  long long n, m, cnt = 1, step2add = 0;
  cin >> n >> m;
  vector<long long> a(m), bucket(n + 1, 0);
  for (long long i = 0; i < (m); ++i) cin >> a[i];
  for (long long i = 0; i < (m); ++i) bucket[a[i]] += 1;
  for (long long i = 0; i <= n - 2; i++) {
    if (bucket[i + 1] == 1 && bucket[i + 2] == 1)
      return cout << 0 << endl, 0;
    else if (bucket[i + 1] == 1)
      cnt *= 1, i++;
    else {
      if (step2add == 0)
        cnt *= 1, step2add++;
      else
        cnt *= 2, step2add = 0;
    }
    cnt %= MOD;
  }
  if (bucket[n - 1] == 1 && bucket[n - 2] == 1)
    return cout << 0 << endl, 0;
  else if (bucket[n - 1] == 0 && bucket[n - 2] == 0)
    cnt *= 2;
  else
    cnt *= 1;
  cout << cnt % MOD << endl;
}
