#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
int p = 1000000007;
ll f(int x) {
  if (x == 1) {
    return 1;
  }
  if (x == 2) {
    return 2;
  }
  ll a = 1, b = 2, c;
  for (int i = 0; i < (int)(x - 2); i++) {
    c = a + b;
    a = b;
    b = c;
  }
  return c;
}
int main() {
  ll n, m, ans = 1;
  cin >> n >> m;
  vector<ll> v(m);
  for (int i = 0; i < (int)(m); i++) {
    cin >> v[i];
    if (i != 0) {
      if (v[i] == v[i - 1] + 1) {
        ans = 0;
        break;
      }
    }
  }
  if (ans == 0) {
    cout << 0 << endl;
  } else {
    if (v[0] != 1) {
      ans *= f(v[0] - 1) % p;
      ans %= p;
    }
    for (int i = 0; i < m - 1; i++) {
      ans *= f(v[i + 1] - v[i] - 2) % p;
      ans %= p;
    }
    ans *= f(n - 1 - v[m - 1]) % p;
    ans %= p;
    cout << ans << endl;
  }
}
