#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int,int> P;

const ll mod = 1e+9 + 7;

int main(){
    int n, m;
    cin >> n >> m;
    int a[n] = {};
    rep(i, m){
        int b;
        cin >> b;
        a[b - 1] ++;
    }

    ll fib[n + 2];
    fib[0] = 1;
    fib[1] = 1;
    rep(i, n){
        fib[i + 2] = fib[i + 1] + fib[i];
        fib[i + 2] %= mod;
    }
    rep(i, n) cout << fib[i] << " ";
    cout << endl;

    int cnt = 1;
    ll ans = 1;
    bool flag = true;
    rep(i, n){
        if (a[i] == 0){
            cnt ++;
        }
        else{
            if (cnt == 0){
                flag = false;
                break;
            }
            ans *= fib[cnt - 1];
            ans %= mod;
            cnt = 0;
        }
    }
    cout << endl;
    if (cnt == n) cout << fib[n] << endl;
    else if (cnt != 0) cout << (ans * fib[cnt - 1]) % mod << endl;
    else if (!flag) cout << 0 << endl;
    else cout << ans << endl;
    return 0;
}