#include <bits/stdc++.h>
using namespace std;
int main() {
  int N = 0;
  int M = 0;
  int a[10000] = {0};
  int b[10000] = {0};
  long long int c[10000] = {0};
  int n = 0;
  int mae = 0;
  int fire = 0;
  int oiuyt = 0;
  long long int ans = 1;
  cin >> N >> M;
  c[0] = 1;
  c[1] = 1;
  for (int i = 2; i < N; i++) {
    c[i] = c[i - 1] + c[i - 2];
  }
  for (int i = 0; i < M; i++) {
    cin >> a[i];
    b[a[i]] = 1;
  }
  for (int i = 0; i < M - 1; i++) {
    if (a[i] + 1 == a[i + 1]) {
      oiuyt++;
    }
  }
  if (oiuyt != 0) {
    cout << 0;
  } else {
    cout << endl;
    for (int i = 0; i < N + 1; i++) {
      if (b[i] == 1 && fire != M + 1) {
        ans *= c[i - 1 - mae];
        ans = ans % 1000000007;
        cout << ans << endl;
        mae = i;
        fire++;
      } else if (fire == M) {
        ans *= c[N - mae - 1];
        ans = ans % 1000000007;
        cout << c[N - mae - 1] << endl;
        break;
      }
    }
    cout << endl;
    for (int i = 0; i < N + 1; i++) {
      cout << b[i];
    }
    cout << ans;
  }
}
