Problem:
Score : 1000 points

Problem Statement

Snuke got a present from his mother on his birthday.
The present was a pair of two sequences a and b, consisting of positive integers.
They satisfied all of the following properties:

The sum of all elements of a is N.

The sum of all elements of b is N.

Any string of length N that satisfies the following two conditions (1) and (2) will also satisfy the condition (3).

(1) Any of the following forms a palindrome: the first a_1 letters, the following a_2 letters, the following a_3 letters and so on.

(2) Any of the following forms a palindrome: the first b_1 letters, the following b_2 letters, the following b_3 letters and so on.

(3) All N letters are the same.

He was happy, until one day he lost both of the sequences.
Now, he only remembers that the sequence a was a permutation of another sequence A of length M.

To bring him happiness again, his mother has decided to give him another pair of sequences a and b that satisfies his favorite properties and is consistent with his memory.

Constraints

1≦N≦10^5

1≦M≦100

1≦A_i≦10^5

The sum of all A_i equals N.

Input

The input is given from Standard Input in the following format:

N M
A_1 A_2 ... A_M

Output

If there exists a pair of sequences a and b that satisfies the properties and is consistent with Snuke's memory, print three lines. The first line must contain the sequence a, the second line must contain the length of the sequence b, and the third line must contain the sequence b.

If such a pair does not exist (because Snuke's memory is wrong or some other reason), print a single line containing the word Impossible (case-sensitive).

Sample Input 1

3 2
2 1

Sample Output 1

1 2
1
3

Sample Input 2

6 1
6

Sample Output 2

6
3
1 2 3

Sample Input 3

55 10
1 2 3 4 5 6 7 8 9 10

Sample Output 3

Impossible

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n, m;
    cin >> n >> m;
    vector<ll> a(m);
    REP(i, m) cin >> a[i];

    ll idx1 = -1, idx2 = -1;
    REP(i, m) {
        if(a[i]%2==0) continue;
        if(idx1 == -1) {
            idx1 = i;
        } else if(idx2 == -1) {
            idx2 = i;
        } else {
            cout << "Impossible" << endl;
            return 0;
        }
    }

    vector<ll> x;
    if(idx1 != -1) x.push_back(a[idx1]);
    REP(i, m) {
        if(i == idx1 || i == idx2) continue;
        x.push_back(a[i]);
    }
    if(idx2 != -1) x.push_back(a[idx2]);

    vector<ll> y;
    if(m == 1) {
        if(x[0]%2) {
            REP(j, x[0]/2) y.push_back(2);
            y.push_back(1);
        }
        else {
            for(ll j=0; j<x[0]; ) {
                if(j==x[0]/2-1) {
                    y.push_back(1);
                    ++j;
                } else if(j==x[0]-1) {
                    y.push_back(1);
                    ++j;
                } else {
                    y.push_back(2);
                    j += 2;
                }
            } 
        }
        goto end;
    }

    REP(i, m) {
        if(i == 0) {
            if(x[i]%2) {
                REP(j, x[i]/2+1) y.push_back(2);
            } else {
                REP(j, x[i]/2/2) y.push_back(2);
                y.push_back(1);
                REP(j, x[i]/2-x[i]/2/2) y.push_back(2);
            }
        } else if(i == m-1) {
            if(x[i]%2) REP(j, x[i]/2) y.push_back(2);
            else {
                if(x[i] == 2) {
                    y.push_back(1);
                    continue;
                }
                for(ll j=x[i]-1; j>3; j-=2) {
                    y.push_back(2);
                } 
                y.push_back(1);
                y.push_back(2);
            }
        } else {
            if(x[i] == 2) {
                y.push_back(2);
                continue;
            }
            for(ll j=x[i]-1; j>3; j-=2) {
                y.push_back(2);
            } 
            y.push_back(4);
        }
        
    }

end:
    REP(i, m) cout << x[i] << (i==m-1?'\n':' ');
    cout << y.size() << endl;
    REP(i, y.size()) cout << y[i] << (i+1==y.size()?'\n':' ');
    cout << flush;

    return 0;
}