#include <bits/stdc++.h>
using namespace std;
long long fibo(long long x) {
  long long dp[100000] = {0};
  dp[0] = 1;
  dp[1] = 1;
  for (long long i = 2; i <= x; i++) {
    dp[i] = dp[i - 1] + dp[i - 2];
  }
  return dp[x];
}
int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> s(M + 1);
  long long b = 0;
  long long a = 0;
  cin >> a;
  s[0] = a - b - 1;
  b = a;
  for (long long i = 1; i < M; i++) {
    cin >> a;
    cout << a << " " << b << endl;
    s[i] = a - b - 2;
    b = a;
  }
  s[M] = N - a - 1;
  long long mul = 1;
  for (long long i = 0; i <= M; i++) {
    cout << s[i] << endl;
    long long f;
    if (s[i] == -1 && i > 0) {
      mul = 0;
      break;
    } else {
      f = fibo(s[i]);
    }
    mul = mul * f % 1000000007;
  }
  cout << mul << endl;
}
