#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long n, long long lelo) {
  if (n == 0) return 1;
  if (n == 1) return a;
  if (n == 2) return (a * a) % lelo;
  if (n % 2)
    return (a * power(a, n - 1, lelo)) % lelo;
  else
    return power(power(a, n / 2, lelo), 2, lelo) % lelo;
}
void swap(long long &a, long long &b) {
  long long tm = a;
  a = b;
  b = tm;
}
const long long N = 3e5 + 5;
void solve() {
  long long n, m, x;
  cin >> n >> m;
  map<long long, long long> ct;
  for (long long(i) = (0); (i) < (m); (i)++) {
    cin >> x;
    ct[x] = 1;
  }
  long long ans = 1;
  for (long long(i) = (0); (i) < (n - 1); (i)++) {
    if (ct[i]) continue;
    if (ct[i + 1] && ct[i + 2]) {
      ans = 0;
      break;
    } else if (ct[i + 1] || ct[i + 2])
      ans = ans % 1000000007;
    else
      ans = (ans * 2) % 1000000007;
  }
  cout << ans % 1000000007;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (long long(i) = (1); (i) < (t + 1); (i)++) {
    solve();
    cout << "\n";
  }
  return 0;
}
