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.
The first line of input contains two integers *n* and *m* (0 ≤ *n* &lt; *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.
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].
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = a; i <= b; ++i)
#define PER(i, a, b) for (int i = a; i >= b; --i)
#define RVC(i, S) for (int i = 0; i < S.size(); ++i)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef vector<int> VI;

inline int read(){
	int x = 0, ch = getchar(), f = 1;
	while (!isdigit(ch)){if (ch == '-') f = -1; ch = getchar();}
	while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return x * f;
}

const int N = 200005;
int n, m, ban[N], rk[N], divs[N], tot;
int in[N], dp[N], id, pre[N];
VI nums[N], to[N];
queue<int> q;

int gcd(int a, int b){return b == 0 ? a : gcd(b, a % b);}

void exgcd(int a, int b, int &x, int &y, int &d){
	if (b == 0){d = a; x = 1; y = 0; return; }
	exgcd(b, a % b, y, x, d); y -= a / b * x;
}

int calc(int a, int b){ // solve x for ax = b (mod m)
	int x, y, d;
	exgcd(a, m, x, y, d);
	x = (x % m + m) % m;
	return x * b / d % m;
}

int print(int x){
	int las = 1;
	if (pre[x]) las = print(pre[x]);
	RVC(i, nums[x]){
		printf("%d ", calc(las, nums[x][i]));
		las = nums[x][i];
	}
	return las;
}

int main(){
	n = read(), m = read();
	REP(i, 1, n) ban[read()] = 1;
	REP(i, 1, m) if (m % i == 0){
		divs[++tot] = i;
		rk[i] = tot;
	}
	REP(i, 1, m - 1) if (!ban[i]) nums[rk[gcd(i, m)]].pb(i);
	REP(i, 1, tot) REP(j, i + 1, tot)
		if (divs[j] % divs[i] == 0){
			to[i].pb(j); ++in[j];
		}
	REP(i, 1, tot) if (!in[i]){
		q.push(i);
		dp[i] = nums[i].size();
	}
	while (!q.empty()){
		int h = q.front(); q.pop();
		// debug("dp[%d] = %d\n", h, dp[h]);
		if (dp[h] > dp[id]) id = h;
		RVC(i, to[h]){
			int y = to[h][i];
			if (in[y]){
				--in[y];
				if (nums[y].size() && dp[h] + nums[y].size() > dp[y]){
					dp[y] = dp[h] + nums[y].size();
					pre[y] = h;
				}
				if (!in[y]) q.push(y);
			}
		}
	}
	if (ban[0]){
		printf("%d\n", dp[id]);
		print(id);
	}
	else{
		printf("%d\n", dp[id] + 1);
		print(id);
		printf("0\n");
	}
	return 0;
}