#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int n;
int x[102], cnt = 0;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
struct mint {
  long long int x;
  mint(long long int x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long int t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
mint modpow(mint a, long long int n) {
  mint res = 1;
  while (n > 0) {
    if (n & 1) res = res * a;
    a = a * a;
    n >>= 1;
  }
  return res;
}
mint choose(int n, int a) {
  mint x = 1, y = 1;
  for (int i = 0; i < (a); ++i) {
    x *= n - i;
    y *= i + 1;
  }
  return x / y;
}
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
int a[100010];
mint dp(int s, int x) {
  if (s == x || x == s + 1) return 1;
  return dp(s, x - 1) + dp(s, x - 2);
}
int main() {
  int m;
  cin >> n >> m;
  a[0] = -1;
  a[m + 1] = n + 1;
  for (int i = 1; i < m + 1; i++) {
    cin >> a[i];
    if (i >= 2 && a[i] <= a[i - 1] + 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  mint ans = 1;
  for (int i = 0; i < (m + 1); ++i) {
    ans *= dp(a[i] + 1, a[i + 1] - 1);
  }
  cout << ans << endl;
  return 0;
}
