#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n = 0, m = 0, x = 0;
  cin >> n >> m;
  vector<bool> ok(n + 1, true);
  for (int i = 0; i < m; ++i) {
    cin >> x;
    ok[x] = false;
  }
  vector<long long int> dp(n + 1);
  dp[0] = 1ll;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j <= min(n, i + 2); ++j) {
      if (ok[j]) {
        dp[j] += dp[i];
        dp[j] %= 1000000007;
      }
    }
  for (int i = 0; i <= n; ++i) {
    cout << dp[i] << " ";
  }
  cout << endl;
  cout << dp[n] << endl;
}
