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].
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:134217728")
using namespace std;
const long long MOD = 1000000000 + 7;
const long long MAXN = 100000 + 100;
const long long MAGIC = 123123123;
const double PI = 4 * atan(1.);
const double EPS = 1E-7;
const int LOGN = 22;
struct cmp_for_set {
  bool operator()(const int& a, const int& b) { return a > b; }
};
void time_elapsed() {
  cout << "\nTIME ELAPSED: " << (double)clock() / CLOCKS_PER_SEC << " sec\n";
}
template <typename T>
void DOUT_VEC(vector<T>& vec) {
  puts("");
  for (auto i : vec) cout << i << " ";
  puts("");
}
template <typename T>
void DOUT_TABLE(vector<vector<T>>& vec) {
  puts("");
  for (auto i : vec) {
    for (auto j : i) cout << j << " ";
    cout << endl;
  }
  puts("");
}
template <typename T>
T gcd(T a, T b) {
  return ((!b) ? a : gcd(b, a % b));
}
template <typename T>
T gcd(T a, T b, T& x, T& y) {
  if (!a) {
    x = 0, y = 1;
    return b;
  }
  T x1, y1;
  T d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
template <typename T>
T lcm(T a, T b) {
  return (a / gcd(a, b)) * b;
}
template <typename T, typename M>
T neg_mod(T a, M mod) {
  return ((a % mod) + mod) % mod;
}
long long binpow(long long x, long long p) {
  long long res = 1;
  while (p) {
    if (p & 1) res *= x;
    x *= x;
    p >>= 1;
  }
  return res;
}
long long binpow_mod(long long x, long long p, long long m) {
  long long res = 1;
  while (p) {
    if (p & 1) res = (res * x) % m;
    x = (x * x) % m;
    p >>= 1;
  }
  return res;
}
int n, m;
vector<int> bannedList;
int isBanned[200001];
int myGcd[200001];
vector<long long> classElements[200001];
vector<int> G[200001];
vector<int> notEmptyClasses;
int used[200001];
int dp[200001];
int nxt[200001];
int go(int v) {
  if (used[v]) return dp[v];
  used[v] = 1;
  nxt[v] = -1;
  int vClassSz = classElements[v].size();
  int bestAns = vClassSz;
  for (int i = 0; i < G[v].size(); ++i) {
    int to = G[v][i];
    int curAns = vClassSz + go(to);
    if (curAns > bestAns) {
      bestAns = curAns;
      nxt[v] = to;
    }
  }
  return dp[v] = bestAns;
}
long long phi(long long n) {
  long long result = n;
  for (long long p = 2; p * p <= n; p++) {
    if (n % p == 0) {
      while (n % p == 0) n /= p;
      result -= result / p;
    }
  }
  if (n > 1) result -= result / n;
  return result;
}
vector<long long> answer(const vector<long long>& rings) {
  vector<long long> v;
  long long last_r = 1;
  long long last_gcd = 1;
  for (int i = 0; i < rings.size(); i++) {
    const vector<long long>& ring = classElements[rings[i]];
    long long cur_gcd = gcd((long long)m, ring[0]);
    if (cur_gcd == 0) {
      v.push_back(0);
      break;
    }
    long long mod = m / cur_gcd;
    last_r = last_r % mod;
    long long phi_mod = phi(mod);
    for (int j = 0; j < ring.size(); j++) {
      long long cur_r = ring[j] / cur_gcd;
      v.push_back((binpow_mod(last_r, phi_mod - 1, mod) * cur_r) % mod *
                  (cur_gcd / last_gcd));
      last_gcd = cur_gcd;
      last_r = cur_r;
    }
  }
  return v;
}
bool isCorrect(const vector<long long>& ans) {
  long long mul = 1;
  set<long long> q;
  for (int i = 0; i < ans.size(); ++i) {
    mul *= ans[i];
    mul %= m;
    if (q.count(mul)) return false;
    if (isBanned) q.insert(mul);
  }
  return true;
}
int main() {
  cin >> n >> m;
  bannedList.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &bannedList[i]);
    isBanned[bannedList[i]] = 1;
  }
  for (int i = 0; i < m; ++i) {
    int g = gcd(i, m);
    myGcd[i] = g;
    if (isBanned[i]) continue;
    if (classElements[g].empty()) {
      notEmptyClasses.push_back(g);
    }
    classElements[g].push_back(i);
  }
  for (int i = 0; i < notEmptyClasses.size(); ++i) {
    for (int j = 0; j < notEmptyClasses.size(); ++j) {
      if (i == j) continue;
      int a = notEmptyClasses[i];
      int b = notEmptyClasses[j];
      if (myGcd[b] == 0) continue;
      if (myGcd[a] % myGcd[b] == 0) {
        G[b].push_back(a);
      }
    }
  }
  for (int i = 0; i < notEmptyClasses.size(); ++i) {
    int v = notEmptyClasses[i];
    go(v);
  }
  int start = notEmptyClasses[0];
  for (int i = 1; i < notEmptyClasses.size(); ++i) {
    int cur = notEmptyClasses[i];
    if (dp[cur] > dp[start]) {
      start = cur;
    }
  }
  vector<long long> classesPath;
  int curv = start;
  while (curv != -1) {
    classesPath.push_back(curv);
    curv = nxt[curv];
  }
  vector<long long> res = answer(classesPath);
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); ++i) {
    printf("%I64d ", res[i]);
  }
  return 0;
}
