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: Accepted)

#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 1e18;
long long int mod = 1000000007;
double Pi = 3.1415926535897932384626;
/*
vector<ll> G[500005];
vector<P> tree[500010];

//big priority queue
priority_queue <ll> pql;
priority_queue <P> pqp;

//small priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
*/
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1 , number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1 , number1);
    }
}


ll i,j,k,ii,jj;
ll n,m;
ll a,b,c,d,e,g,h,r;
ll l;
ll num;
ll x[500005],y[500005],z[500005];
ll ans[180000];
bool dame;
char s[500005];

void solve2(){
	a = 0;
	for(i=0;i<m;i++){
		if(x[i] % 2 == 1){
			b = x[a];
			x[a] = x[i];
			x[i] = b;
			if(a == m-1)break;
			a = m-1;
		}
	}
	for(i=0;i<m;i++){
		pe(x[i]);
	}
	el;
	k = m + 1;
	y[0] = x[0] - 1;
	if(y[0] == 0)k--;
	y[1] = 2;
	for(i=1;i<m-1;i++){
		y[i+1] = x[i];
	}
	y[m] = x[m-1]-1;
	if(y[m] == 0)k--;
	p(k);
	for(i=0;i<=m;i++){
		if(y[i] == 0)continue;
		pe(y[i]);
	}
	return;
}
void solve1(){
	for(i=0;i<m;i++){
		if(x[i] % 2 == 1){
			b = x[i];
			x[i] = x[0];
			x[0] = b;
			break;
		}
	}
	for(i=0;i<m;i++){
		pe(x[i]);
	}
	el;
	p(m);
	pe(x[0]+1);
	for(i=1;i<m-1;i++){
		pe(x[i]);
	}
	p(x[m-1]-1);
}

int main(){
    
    cin >> n >> m;
	k = n;
	for(i=0;i<m;i++){
		cin >> x[i];
		a += x[i]/2;
		if(x[i] % 2 == 1)b++;
	}

	if(a + n/2 < n-1){
        p("Impossible");
	}else if(m == 1){
		p(x[0]);
		if(x[0] % 2 == 1){
			p((n+1)/2);
			while(n >= 2){
				pe(2);
				n -= 2;
			}
			p(1);
		}else{
			if(n != 2){
				p(2);
				pe(2);
				p(n-2);
			}else{
				p(2);
				pe(1);p(1);
			}
		}

	}else if(b == 0){
		//assert(n == -1);
		for(i=0;i<m;i++){
			pe(x[i]);
		}
		el;
		p(m);
		pe(x[0] + 1);
		for(i=1;i<m-1;i++)pe(x[i]);
		p(x[m-1]-1);
	}else if(b == 2){
		solve2();
	}else{
		solve1();
	}
    
   
    return 0;
}