#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000007;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long c, long long d) { return c / gcd(c, d) * d; }
int main() {
  int n, m;
  cin >> n >> m;
  vector<unsigned long long> dp(n + 2, INF);
  vector<unsigned long long> broken(m, INF);
  for (int j = 0; j < (m); ++j) {
    cin >> broken.at(j);
    dp.at(broken.at(j)) = 0;
  }
  unsigned long long ans = 1;
  long long seq_flg = false;
  bitset<100000> digits;
  for (long long i = n; i > 1; i--) {
    if (dp[i] != 0 && dp[i - 1] != 0 && dp[i - 2] != 0) {
      ans *= 2;
    }
    if (dp[i] == 0 && dp[i - 1] == 0) {
      seq_flg = true;
    }
    if (seq_flg) {
      ans = 0;
      break;
    }
    ans %= INF;
  }
  cout << ans % INF << endl;
}
