#include <bits/stdc++.h>
using namespace std;
template <class T>
bool INRANGE(T x, T a, T b) {
  return a <= x && x <= b;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
void printv(vector<T> v) {
  for (T t : v) {
    cout << t << " ";
  }
  cout << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<int> dp(N + 1, 0);
  for (int i = 0; i < (M); ++i) {
    int t;
    cin >> t;
    dp[t] = -1;
  }
  dp[0] = 1;
  for (int i = 0; i < (N + 1); ++i) {
    if (dp[i] < 0)
      continue;
    else
      dp[i] %= 1000000007;
    if (dp[i + 1] >= 0 and i + 1 < N + 1) dp[i + 1] += dp[i] % 1000000007;
    if (dp[i + 2] >= 0 and i + 2 < N + 1) dp[i + 2] += dp[i] % 1000000007;
  }
  for (int i = 0; i < (N + 1); ++i) {
    cout << dp[i] << " ";
  }
  cout << endl;
  cout << dp[N] % 1000000007 << endl;
  return 0;
}
