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 Rust (1.15.1) (judge verdict: Wrong Answer)

// use std::ops::{Index, IndexMut};
// use std::cmp::{Ordering, min, max};
// use std::collections::{BinaryHeap, BTreeMap};
// use std::collections::btree_map::Entry::{Occupied, Vacant};
// use std::clone::Clone;

fn getline() -> String{
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            s.trim().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let mut iter = s.trim().split(' ');
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*) 
        }
    };
}

macro_rules! readlvec {
    ($t: ty) => {
        {
            let s = getline();
            let iter = s.trim().split(' ');
            iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
        }
    }
}

macro_rules! mvec {
    ($v: expr, $s: expr) => {
        vec![$v; $s]
    };
    ($v: expr, $s: expr, $($t: expr),*) => {
        vec![mvec!($v, $($t),*); $s]
    };
}

macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

fn printiter<'a, T>(v: &'a T)
where
    &'a T: std::iter::IntoIterator, 
    <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display {
    for (i,e) in v.into_iter().enumerate() {
        if i != 0 {
            print!(" ");
        }
        print!("{}", e);
    }
    println!("");
}

fn solve(n: usize, m: usize, a: Vec<usize>) -> Option<(Vec<usize>, Vec<usize>)> {
    let mut ans0 = {
        let mut v1: Vec<_> = a.iter().filter(|&x| x%2 == 1).map(|x| *x).collect();
        if v1.len() > 2 {
            return None;
        }
        let mut res = Vec::new();
        if let Some(&x) = v1.last() {
            res.push(x);
            v1.pop();
        }
        res.extend(a.iter().filter(|&x| x%2 == 0).map(|x| *x));
        if let Some(&x) = v1.last() {
            res.push(x);
            v1.pop();
        }
        res
    };
    assert_eq!(ans0.len(), a.len());
    
    let ans = if ans0.len() == 1 {
        vec![ans0[0]-1, 1]
    } else { 
        let mut ans = Vec::new();
        for (i, &e) in ans0.iter().enumerate() {
            if e%2 == 1 {
                if i == 0 {
                    if e != 1 {
                        ans.push(e-1);
                    }
                } else {
                    ans.push(e+1);
                }
            } else {
                if i == 0 {
                    ans.push(e-1);
                } else {
                    ans.push(e);
                    if i == ans0.len()-1 {
                        ans.push(1);
                    }
                }
            }
        }
        ans
    };
    Some((ans0, ans))
}

fn main() {
    let(n, m) = readl!(usize, usize);
    let a = readlvec!(usize);
    if let Some((ans0, ans1)) = solve(n, m, a) {
        printiter(&ans0);
        println!("{}", ans1.len());
        printiter(&ans1);
        assert_eq!(ans0.iter().sum::<usize>(), n);
        assert_eq!(ans1.iter().sum::<usize>(), n);
    } else {
        println!("Impossible");
    }
}