You are given an integer m, and a list of n distinct integers between 0 and m - 1.

You would like to construct a sequence satisfying the properties:

  * Each element is an integer between 0 and m - 1, inclusive. 
  * All prefix products of the sequence modulo m are distinct. 
  * No prefix product modulo m appears as an element of the input list. 
  * The length of the sequence is maximized. 



Construct any sequence satisfying the properties above.

Input

The first line of input contains two integers n and m (0 ≤ n < m ≤ 200 000) — the number of forbidden prefix products and the modulus.

If n is non-zero, the next line of input contains n distinct integers between 0 and m - 1, the forbidden prefix products. If n is zero, this line doesn't exist.

Output

On the first line, print the number k, denoting the length of your sequence.

On the second line, print k space separated integers, denoting your sequence.

Examples

Input

0 5


Output

5
1 2 4 3 0


Input

3 10
2 9 1


Output

6
3 9 2 9 8 0

Note

For the first case, the prefix products of this sequence modulo m are [1, 2, 3, 4, 0].

For the second case, the prefix products of this sequence modulo m are [3, 7, 4, 6, 8, 0].
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.math.BigInteger;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        LinearCongruence solver = new LinearCongruence();
        solver.solve(1, in, out);
        out.close();
    }

    static class LinearCongruence {
        int np;
        static final int MAXN = 200000;
        static int nprime = 0;
        static int[] prime;
        int[] lprime = new int[100];
        int[] lcnt = new int[100];
        int ndiv = 0;
        int[] div = new int[MAXN + 1];
        int n;
        int m;
        boolean[] black;
        int[] pr;
        int[] sv;
        int[] best;

        static {
            int sqrt = (int) Math.sqrt(MAXN) + 1;
            prime = new int[sqrt + 1];
            for (int i = 2; i < sqrt; ++i)
                if (IntMath.isPrime(i)) {
                    prime[nprime++] = i;
                }
        }

        void getAllFactor(int n) {
            np = 0;
            for (int i = 0; i < nprime; ++i) {
                if (n % prime[i] == 0) {
                    lprime[np] = prime[i];
                    lcnt[np] = 0;

                    while (n % prime[i] == 0) {
                        n /= prime[i];
                        lcnt[np]++;

                    }
                    np++;
                    if (n == 1) break;
                }
            }
            if (n > 1) {
                lprime[np] = n;
                lcnt[np] = 1;
                np++;
            }

            ndiv = 0;
            rec(1, 0);
            div[ndiv++] = 1;
            //for(int i = 0; i < ndiv; ++i) System.err.println(div[i]);
        }

        private void rec(int mul, int id) {
            if (mul != 1) {
                div[ndiv++] = mul;

            }
            for (int i = id; i < np; ++i) {
                int lastMul = 1;
                for (int mu = 1; mu <= lcnt[i]; mu++) {
                    lastMul *= lprime[i];
                    rec(mul * lastMul, i + 1);

                }
            }
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {

            n = in.nextInt();
            m = in.nextInt();
            black = new boolean[m];
            for (int i = 0; i < n; ++i) {
                black[in.nextInt()] = true;
            }
            ArrayList<Pair<Integer, Integer>> lp = new ArrayList<>();

            for (int i = 0; i < m; ++i)
                if (!black[i]) {
                    //System.out.println(i + " " + IntMath.gcd(i, m));
                    lp.add(new Pair<>(IntMath.gcd(i, m), i));
                }
            Collections.sort(lp);

            pr = new int[m + 1];
            sv = new int[m + 1];
            Arrays.fill(pr, -1);
            best = new int[m + 1];
            for (Pair<Integer, Integer> pa : lp) {
                int nn = pa.second;
                int gg = pa.first;
                if (nn != 0) {
                    getAllFactor(nn);
                } else {
//                gg = m - 1;
                    ndiv = m - 1;
                    for (int i = 1; i <= m - 1; ++i) {
                        div[i - 1] = i;
                    }
                }
                int be = 1;

                for (int i = 0; i < ndiv; ++i) {
                    if (best[div[i]] + 1 > be) {
                        be = best[div[i]] + 1;
                        pr[nn] = sv[div[i]];
                    }
                }

                if (be > best[gg]) {
                    best[gg] = be;
                    sv[gg] = nn;
                }
            }

            int be = 0;
            int s = -1;
            for (int i = 1; i <= m; ++i) {
                if (best[i] > be) {
                    be = best[i];
                    s = i;
                }
            }

            if (be == 0) throw new RuntimeException();
            //System.err.println(be);
            int[] re = new int[m];
            int nre = 0;

            int bd = sv[s];
            while (bd != -1) {
                //System.out.print(bd + " ");
                re[nre++] = bd;
                bd = pr[bd];
            }

            MathUtils.reverseArray(re, 0, nre);
            out.println(nre);
            out.print(re[0]);
            for (int i = 1; i < nre; ++i) {
                int a = re[i - 1];
                int b = re[i];
                int g = IntMath.gcd(a, m);
                int aa = a / g;
                int bb = b / g;
                int mm = m / g;
                int x = (int) ((1l * MathUtils.modInverse(aa, mm) * bb) % mm);
                out.print(" " + x);
            }
        }

    }

    static final class MathPreconditions {
        static int checkNonNegative(String role, int x) {
            if (x < 0) {
                throw new IllegalArgumentException(role + " (" + x + ") must be >= 0");
            }
            return x;
        }

        static long checkNonNegative(String role, long x) {
            if (x < 0) {
                throw new IllegalArgumentException(role + " (" + x + ") must be >= 0");
            }
            return x;
        }

        private MathPreconditions() {
        }

    }

    static final class LongMath {
        static final long FLOOR_SQRT_MAX_LONG = 3037000499L;
        private static final int SIEVE_30 = ~((1 << 1) | (1 << 7) | (1 << 11) | (1 << 13)
                | (1 << 17) | (1 << 19) | (1 << 23) | (1 << 29));
        private static final long[][] millerRabinBaseSets = {
                {291830, 126401071349994536L},
                {885594168, 725270293939359937L, 3569819667048198375L},
                {273919523040L, 15, 7363882082L, 992620450144556L},
                {47636622961200L, 2, 2570940, 211991001, 3749873356L},
                {
                        7999252175582850L,
                        2,
                        4130806001517L,
                        149795463772692060L,
                        186635894390467037L,
                        3967304179347715805L
                },
                {
                        585226005592931976L,
                        2,
                        123635709730000L,
                        9233062284813009L,
                        43835965440333360L,
                        761179012939631437L,
                        1263739024124850375L
                },
                {Long.MAX_VALUE, 2, 325, 9375, 28178, 450775, 9780504, 1795265022}
        };

        public static boolean isPrime(long n) {
            if (n < 2) {
                MathPreconditions.checkNonNegative("n", n);
                return false;
            }
            if (n == 2 || n == 3 || n == 5 || n == 7 || n == 11 || n == 13) {
                return true;
            }

            if ((SIEVE_30 & (1 << (n % 30))) != 0) {
                return false;
            }
            if (n % 7 == 0 || n % 11 == 0 || n % 13 == 0) {
                return false;
            }
            if (n < 17 * 17) {
                return true;
            }

            for (long[] baseSet : millerRabinBaseSets) {
                if (n <= baseSet[0]) {
                    for (int i = 1; i < baseSet.length; i++) {
                        if (!LongMath.MillerRabinTester.test(baseSet[i], n)) {
                            return false;
                        }
                    }
                    return true;
                }
            }
            throw new AssertionError();
        }

        private LongMath() {
        }

        private enum MillerRabinTester {
            /**
             * Works for inputs ≤ FLOOR_SQRT_MAX_LONG.
             */
            SMALL {
                long mulMod(long a, long b, long m) {
        /*
         * NOTE(lowasser, 2015-Feb-12): Benchmarks suggest that changing this to
         * UnsignedLongs.remainder and increasing the threshold to 2^32 doesn't pay for itself, and
         * adding another enum constant hurts performance further -- I suspect because bimorphic
         * implementation is a sweet spot for the JVM.
         */
                    return (a * b) % m;
                }


                long squareMod(long a, long m) {
                    return (a * a) % m;
                }
            },
            /**
             * Works for all nonnegative signed longs.
             */
            LARGE {
                /** Returns (a + b) mod m. Precondition: {@code 0 <= a}, {@code b < m < 2^63}. */
                private long plusMod(long a, long b, long m) {
                    return (a >= m - b) ? (a + b - m) : (a + b);
                }

                /**
                 * Returns (a * 2^32) mod m. a may be any unsigned long.
                 */
                private long times2ToThe32Mod(long a, long m) {
                    int remainingPowersOf2 = 32;
                    do {
                        int shift = Math.min(remainingPowersOf2, Long.numberOfLeadingZeros(a));
                        // shift is either the number of powers of 2 left to multiply a by, or the biggest shift
                        // possible while keeping a in an unsigned long.
                        a = UnsignedLongs.remainder(a << shift, m);
                        remainingPowersOf2 -= shift;
                    } while (remainingPowersOf2 > 0);
                    return a;
                }


                long mulMod(long a, long b, long m) {
                    long aHi = a >>> 32; // < 2^31
                    long bHi = b >>> 32; // < 2^31
                    long aLo = a & 0xFFFFFFFFL; // < 2^32
                    long bLo = b & 0xFFFFFFFFL; // < 2^32

        /*
         * a * b == aHi * bHi * 2^64 + (aHi * bLo + aLo * bHi) * 2^32 + aLo * bLo.
         *       == (aHi * bHi * 2^32 + aHi * bLo + aLo * bHi) * 2^32 + aLo * bLo
         *
         * We carry out this computation in modular arithmetic. Since times2ToThe32Mod accepts any
         * unsigned long, we don't have to do a mod on every operation, only when intermediate
         * results can exceed 2^63.
         */
                    long result = times2ToThe32Mod(aHi * bHi /* < 2^62 */, m); // < m < 2^63
                    result += aHi * bLo; // aHi * bLo < 2^63, result < 2^64
                    if (result < 0) {
                        result = UnsignedLongs.remainder(result, m);
                    }
                    // result < 2^63 again
                    result += aLo * bHi; // aLo * bHi < 2^63, result < 2^64
                    result = times2ToThe32Mod(result, m); // result < m < 2^63
                    return plusMod(
                            result,
                            UnsignedLongs.remainder(aLo * bLo /* < 2^64 */, m),
                            m);
                }


                long squareMod(long a, long m) {
                    long aHi = a >>> 32; // < 2^31
                    long aLo = a & 0xFFFFFFFFL; // < 2^32

        /*
         * a^2 == aHi^2 * 2^64 + aHi * aLo * 2^33 + aLo^2
         *     == (aHi^2 * 2^32 + aHi * aLo * 2) * 2^32 + aLo^2
         * We carry out this computation in modular arithmetic.  Since times2ToThe32Mod accepts any
         * unsigned long, we don't have to do a mod on every operation, only when intermediate
         * results can exceed 2^63.
         */
                    long result = times2ToThe32Mod(aHi * aHi /* < 2^62 */, m); // < m < 2^63
                    long hiLo = aHi * aLo * 2;
                    if (hiLo < 0) {
                        hiLo = UnsignedLongs.remainder(hiLo, m);
                    }
                    // hiLo < 2^63
                    result += hiLo; // result < 2^64
                    result = times2ToThe32Mod(result, m); // result < m < 2^63
                    return plusMod(
                            result,
                            UnsignedLongs.remainder(aLo * aLo /* < 2^64 */, m),
                            m);
                }
            },;

            static boolean test(long base, long n) {
                // Since base will be considered % n, it's okay if base > FLOOR_SQRT_MAX_LONG,
                // so long as n <= FLOOR_SQRT_MAX_LONG.
                return ((n <= FLOOR_SQRT_MAX_LONG) ? SMALL : LARGE).testWitness(base, n);
            }

            abstract long mulMod(long a, long b, long m);

            abstract long squareMod(long a, long m);

            private long powMod(long a, long p, long m) {
                long res = 1;
                for (; p != 0; p >>= 1) {
                    if ((p & 1) != 0) {
                        res = mulMod(res, a, m);
                    }
                    a = squareMod(a, m);
                }
                return res;
            }

            private boolean testWitness(long base, long n) {
                int r = Long.numberOfTrailingZeros(n - 1);
                long d = (n - 1) >> r;
                base %= n;
                if (base == 0) {
                    return true;
                }
                // Calculate a := base^d mod n.
                long a = powMod(base, d, n);
                // n passes this test if
                //    base^d = 1 (mod n)
                // or base^(2^j * d) = -1 (mod n) for some 0 <= j < r.
                if (a == 1) {
                    return true;
                }
                int j = 0;
                while (a != n - 1) {
                    if (++j == r) {
                        return false;
                    }
                    a = squareMod(a, n);
                }
                return true;
            }

        }

    }

    static final class IntMath {
        public static int gcd(int a, int b) {
    /*
     * The reason we require both arguments to be >= 0 is because otherwise, what do you return on
     * gcd(0, Integer.MIN_VALUE)? BigInteger.gcd would return positive 2^31, but positive 2^31 isn't
     * an int.
     */
            MathPreconditions.checkNonNegative("a", a);
            MathPreconditions.checkNonNegative("b", b);
            if (a == 0) {
                // 0 % b == 0, so b divides a, but the converse doesn't hold.
                // BigInteger.gcd is consistent with this decision.
                return b;
            } else if (b == 0) {
                return a; // similar logic
            }
    /*
     * Uses the binary GCD algorithm; see http://en.wikipedia.org/wiki/Binary_GCD_algorithm. This is
     * >40% faster than the Euclidean algorithm in benchmarks.
     */
            int aTwos = Integer.numberOfTrailingZeros(a);
            a >>= aTwos; // divide out all 2s
            int bTwos = Integer.numberOfTrailingZeros(b);
            b >>= bTwos; // divide out all 2s
            while (a != b) { // both a, b are odd
                // The key to the binary GCD algorithm is as follows:
                // Both a and b are odd. Assume a > b; then gcd(a - b, b) = gcd(a, b).
                // But in gcd(a - b, b), a - b is even and b is odd, so we can divide out powers of two.

                // We bend over backwards to avoid branching, adapting a technique from
                // http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax

                int delta = a - b; // can't overflow, since a and b are nonnegative

                int minDeltaOrZero = delta & (delta >> (Integer.SIZE - 1));
                // equivalent to Math.min(delta, 0)

                a = delta - minDeltaOrZero - minDeltaOrZero; // sets a to Math.abs(a - b)
                // a is now nonnegative and even

                b += minDeltaOrZero; // sets b to min(old a, b)
                a >>= Integer.numberOfTrailingZeros(a); // divide out all 2s, since 2 doesn't divide b
            }
            return a << Math.min(aTwos, bTwos);
        }

        public static boolean isPrime(int n) {
            return LongMath.isPrime(n);
        }

        private IntMath() {
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

    static final class UnsignedLongs {
        private UnsignedLongs() {
        }

        private static long flip(long a) {
            return a ^ Long.MIN_VALUE;
        }

        public static int compare(long a, long b) {
            return Longs.compare(flip(a), flip(b));
        }

        public static long remainder(long dividend, long divisor) {
            if (divisor < 0) { // i.e., divisor >= 2^63:
                if (compare(dividend, divisor) < 0) {
                    return dividend; // dividend < divisor
                } else {
                    return dividend - divisor; // dividend >= divisor
                }
            }

            // Optimization - use signed modulus if dividend < 2^63
            if (dividend >= 0) {
                return dividend % divisor;
            }

    /*
     * Otherwise, approximate the quotient, check, and correct if necessary. Our approximation is
     * guaranteed to be either exact or one less than the correct value. This follows from the fact
     * that floor(floor(x)/i) == floor(x/i) for any real x and integer i != 0. The proof is not
     * quite trivial.
     */
            long quotient = ((dividend >>> 1) / divisor) << 1;
            long rem = dividend - quotient * divisor;
            return rem - (compare(rem, divisor) >= 0 ? divisor : 0);
        }

    }

    static class MathUtils {
        static long _invMod(long a, long b) {
            return 1 < a ? b - _invMod(b % a, a) * b / a : 1;
        }

        public static int modInverse(int a, int m) {
//		long B = fecmaPow(a, m - 2, m);
//		if (B < 0) {
//			B += (Math.abs(B) / m + 1) * m;
//			B %= m;
//		}
//		return (int) B;

            return (int) _invMod(a, m);

        }

        public static void swap(int[] a, int i, int j) {
            int t = a[i];
            a[i] = a[j];
            a[j] = t;
        }

        public static void reverseArray(int[] a, int first, int last) {
            while ((first != last) && (first != --last)) {
                swap(a, first, last);
                ++first;
            }
        }

    }

    static final class Longs {
        private Longs() {
        }

        public static int compare(long a, long b) {
            return (a < b) ? -1 : ((a > b) ? 1 : 0);
        }

    }

    static class Pair<T1 extends Comparable<T1>, T2 extends Comparable<T2>> implements Comparable<Pair<T1, T2>> {
        public T1 first;
        public T2 second;

        public Pair(T1 first, T2 second) {
            this.first = first;
            this.second = second;
        }


        public int compareTo(Pair<T1, T2> o) {
            int _c1 = first.compareTo(o.first);
            if (_c1 != 0)
                return _c1;
            return second.compareTo(o.second);
        }

        public String toString() {
            return first + " " + second;
        }


        public int hashCode() {
            return first.hashCode() ^ second.hashCode();
        }

        public boolean equals(Object obj) {
            if (obj instanceof Pair) {
                Pair p = (Pair) obj;
                return first.equals(p.first) && second.equals(p.second);
            }
            return false;
        }

    }
}

