#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
long long const mod = 1e9 + 7;
vector<bool> block;
int main() {
  long long n, m;
  cin >> n >> m;
  block.resize(n + 1);
  for (int i = 0; i < m; i++) {
    long long x;
    cin >> x;
    block[x] = true;
  }
  debug() << " ["
          << "block"
             ": "
          << (block) << "] ";
  long long ans = 1;
  for (long long i = 0; i < n; i++) {
    if (block[i]) continue;
    int c = 0;
    if (i + 1 <= n && !block[i + 1]) c++;
    if (i + 2 <= n && !block[i + 2]) c++;
    debug() << " ["
            << "i"
               ": "
            << (i)
            << "] "
               " ["
            << "block[i]"
               ": "
            << (block[i])
            << "] "
               " ["
            << "c"
               ": "
            << (c) << "] ";
    ans = ((ans % mod) * (c % mod)) % mod;
  }
  cout << ans % mod << endl;
  return 0;
}
