#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
const int MOD = 1000000007;
int main() {
  int N, M;
  cin >> N >> M;
  vector<bool> oks(N + 1, true);
  for (int i = 0; i < M; i++) {
    int ai;
    cin >> ai;
    oks[ai] = false;
  }
  vector<long long> dps(N + 1);
  dps[0] = 1;
  for (int now = 0; now < N; ++now) {
    for (int next = now + 1; next <= min(N, now + 2); ++next) {
      if (oks[next]) {
        dps[next] += dps[now];
        dps[next] %= MOD;
      }
    }
  }
  cout << dps[N] << endl;
  cout << dps[N] << endl;
  return 0;
}
