#include <bits/stdc++.h>
using namespace std;
bool br[100010];
long long dp[100010];
int main() {
  int n, m;
  cin >> n >> m;
  int a[m];
  for (int i = 0; i < m; ++i) {
    cin >> a[i];
    br[a[i]] = true;
    if (a[i] - a[i - 1] == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  dp[0] = 1;
  dp[1] = 1;
  long long ans = 1;
  for (int i = 2; i <= n; ++i) {
    if (br[i] == true) continue;
    if (br[i - 1] == false && br[i - 2] == false) {
      ans *= 2;
      ans %= 1000000007;
    }
  }
  ans %= 1000000007;
  cout << ans << endl;
}
