#include <bits/stdc++.h>
using namespace std;
long long stairway(long long a) {
  long long ans = 0;
  if (a == 0) {
    return 0;
  }
  if (a == 1) {
    return 1;
  }
  ans += stairway(a - 1);
  ans += stairway(a - 2);
  ans %= 1000000007;
  return ans;
}
int main() {
  long long N, m;
  cin >> N >> m;
  vector<long long> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i);
  }
  long long ans = 1;
  for (int i = 0; i < m - 1; i++) {
    long long data = stairway(a.at(i + 1) - a.at(i) - 1);
    ans *= data;
    if (a.at(i + 1) - a.at(i) == 1) {
      ans = 0;
      break;
    }
    ans %= 1000000007;
  }
  long long x = stairway(N - a.at(m - 1));
  long long y = stairway(a.at(0));
  ans *= x;
  ans %= 1000000007;
  ans *= y;
  ans %= 1000000007;
  cout << ans << endl;
}
