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)

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    return ret;
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.is_err() || res.ok().unwrap() == 0 || u8b[0] <= ' ' as u8 {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = std::string::String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}
fn parse<T: std::str::FromStr>(s: &str) -> T { s.parse::<T>().ok().unwrap() }

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { parse(&get_word()) }

#[allow(dead_code)]
macro_rules! d {
    ($e:expr) => {
        {
            let a = $e;
            println!("{} = {:?}", stringify!($e), a);
            a
        }
    }
}

#[allow(dead_code)]
macro_rules! tee {
    ($e:expr) => {
        {
            let a = $e;
            println!("{:?}", a);
            a
        }
    }
}

fn permute(mut a: Vec<u64>) -> Option<Vec<u64>> {
    if a.len() == 1 {
        Some(a)
    } else {
        let odds: Vec<_> = (0..a.len()).filter(|x| a[*x] % 2 == 1).collect();

        match odds.len() {
            0 => Some(a),
            1 => {
                let i = odds[0];
                a.swap(0, i);
                Some(a)
            },
            2 => {
                let i = odds[0];
                let j = odds[1];
                let end = a.len() - 1;
                a.swap(0, i);
                a.swap(j, end);
                Some(a)
            }
            _ => None
        }
    }
}

fn getb(a: &Vec<u64>) -> Vec<u64> {
    let mut b = Vec::new();

    if a.len() == 1 {
        b.push(1);
        b.push(a[0] - 1);
    } else {
        if a[0] % 2 == 1 {
            b.push(a[0] + 1);
        } else {
            b.push(1);
            b.push(a[0]);
        }

        for i in 1..a.len()-1 {
            b.push(a[i]);
        }

        b.push(a[a.len() - 1] - 1);
    }

    b
}

fn main() {
    let n: u64 = get();
    let m: usize = get();
    let a: Vec<u64> = (0..m).map(|_| get()).collect();

    if let Some(a) = permute(a) {
        let b = getb(&a);
        for x in &a {
            print!("{} ", x);
        }
        println!("");
        println!("{}", b.len());
        for x in &b {
            print!("{} ", x);
        }
        println!("");
    } else {
        println!("Impossible");
    }
}