#include <bits/stdc++.h>
using namespace std;
int64_t NC(int64_t A) {
  if (A <= 0) {
    return 0;
  }
  if (A == 1) {
    return 1;
  }
  if (A == 2) {
    return 2;
  }
  return NC(A - 1) + NC(A - 2);
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> broken(M);
  for (int i = 0; i < M; i++) {
    cin >> broken.at(i);
  }
  int64_t ans = 1;
  int64_t temp = NC(broken.at(0) - 1) % 1000000007LL;
  if (temp != 0) {
    ans *= temp;
  }
  temp = NC(N - broken.at(M - 1) - 1) % 1000000007LL;
  if (temp != 0) {
    ans *= temp;
  }
  for (int i = 0; i < M - 1; i++) {
    temp = NC(broken.at(i + 1) - broken.at(i) - 2) % 1000000007LL;
    if (temp == 0) {
      continue;
    }
    ans *= temp;
    ans %= 1000000007LL;
    cout << temp << ' ' << ans << endl;
  }
  cout << ans << endl;
}
