#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<long> A(N + 1, 1);
  for (int i = 0, a; i < M; i++) {
    cin >> a;
    A[a] = 0;
  }
  int ans = 0;
  cout << A[0] << endl;
  cout << A[1] << endl;
  for (int i = 2; i < N + 1; i++) {
    if (A[i] != 0) {
      A[i] = (A[i - 1] + A[i - 2]) % 1000000007;
    }
  }
  cout << A.back();
  return 0;
}
