#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const ll mod = 1e9 + 7;
ll ans;
int N;
int main() {
  ans = 0;
  cin >> N;
  int M;
  cin >> M;
  vector<bool> kiken(N, true);
  int a;
  a = 0;
  for (int i = 0; i < M; i++) {
    cin >> a;
    kiken[a] = false;
  }
  cout << N << " " << M << endl;
  vector<ll> dp(N + 1);
  dp[0] = 1;
  for (int now = 0; now < N; ++now) {
    for (int next = now + 1; next <= min(N, now + 2); ++next) {
      if (kiken[next]) {
        dp[next] += dp[now];
        dp[next] %= mod;
      }
    }
  }
  cout << dp[N] << endl;
  return 0;
}
