#include <bits/stdc++.h>
using namespace std;
long long count(long long start, long long end) {
  long long sa = end - start;
  long long cou[3] = {0, 0, 0};
  for (long long i = 0; i < sa; i++) {
    if (i == 0) {
      cou[0] = 1;
    } else if (i == 1) {
      cou[1] = 2;
    } else {
      cou[2] = cou[0] + cou[1];
      cou[0] = cou[1];
      cou[1] = cou[2];
    }
  }
  if (sa == 1 || sa == 0) {
    return 1;
  } else if (sa == 2) {
    return 2;
  } else {
    return (cou[2] % 1000000007);
  }
}
int main() {
  long long N, M;
  cin >> N >> M;
  long long a[M];
  long long before = -1;
  int flag = 0;
  for (long long i = 0; i < M; i++) {
    cin >> a[i];
    if (before != -1) {
      if (before == a[i] - 1) {
        flag = 1;
      }
      before = a[i];
    } else {
      before = a[i];
    }
  }
  long long ans = 1;
  long long now = 0;
  if (flag == 0) {
    for (long long i = 0; i < M; i++) {
      ans *= count(now, a[i] - 1);
      ans %= 1000000007;
      now = a[i] + 1;
    }
    ans *= count(now, N);
    ans %= 1000000007;
  } else {
    ans = 0;
  }
  cout << ans << endl;
}
