#include <bits/stdc++.h>
#define fi first
#define se second
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int N = 1e5 + 5;
 
int n;
ll a[N], p[62];
 
void insert(ll x) {
    for(int i = 60; i >= 0; i--) {
        if(x >> i & 1) {
            if(!p[i]) {
                p[i] = x;
                break;
            }
            x ^= p[i];
            //cout<<x<<endl;
        }
    }
}
 
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    ll all = 0;
    for(int i = 1; i <= n; i++) cin >> a[i], all ^= a[i];
    for(int i = 0; i <= 60; i++) {
        if(all >> i & 1) {
            for(int j = 1; j <= n; j++) {
                if(a[j] >> i & 1) a[j] -= (1ll << i);
            }
        }
    }
    for(int i = 1; i <= n; i++) insert(a[i]);//,cout<<a[i]<<endl;;
    ll ans = 0;
    for(int i = 60; i >= 0; i--) {
    	//cout<<i<<" "<<p[i]<<" "<<(ans&(1ll<<i)==0)<<endl;
    	
    	if((p[i]!=0)&&((ans&(1ll<<i))==0))
    	{
    		ans=p[i]^ans;
    		//cout<<ans<<endl;
		}
    	
    }
    //cout<<ans<<endl;
    cout << ans + (ans ^ all);
    return 0;
}
//Be Name Khoda, Besmellah Rahmane Rahim, In The Name Of God;
//#include<bits/stweight++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>
#include <stdio.h>
#include <string.h>
#include<iomanip>
#include<unordered_map>
#include<unordered_set>
#include <fstream>
 
using namespace std;
const int N = 1000 + 5;
int a[N];
int n,m;
vector<int> ans;
 
int main()
{
    cin >> n >> m;
    int cnt = 0;
    for(int i = 1; i <= m; ++i) 
    {
        cin >> a[i];
        cnt += a[i] % 2;
    }
    if (cnt > 2)
    {
        cout << "Impossible" << endl;
        return 0;
    }
    for(int i = 2; i < m; i++) 
    {
        if (a[i] % 2) 
        {
            if (a[1] % 2)
            {
                swap(a[i], a[m]);
            }
            else
            {
                swap(a[i], a[1]);
            }
        }
    }
    for (int i = 1; i <= m; i++) 
    {
        cout << a[i] << " ";
    }
    cout << endl;
    if (m == 1 && a[1] == 1) 
    {
        ans.push_back(1);
    }
    else 
    {
        if (m == 1)
        { 
            ans.push_back(a[1] - 1);
            ans.push_back(1);
        }
        else 
        {
            if (a[1] != 1) 
            {
                ans.push_back(a[1] - 1);
            }
            for (int i = 2; i < m; i++) 
            {
                ans.push_back(a[i]);
            }
            ans.push_back(a[m] + 1);
        }
    }
    cout << ans.size() << endl;
    for(int i = 0; i < ans.size(); i++) 
    {
        cout << ans[i] << " ";
    }
}