atcoder#ABC215D. [ABC215D] Coprime 2

[ABC215D] Coprime 2

Score : 400400 points

Problem Statement

Given a sequence of NN positive integers A=(A1,A2,,AN)A=(A_1,A_2,\dots,A_N), find every integer kk between 11 and MM (inclusive) that satisfies the following condition:

  • gcd(Ai,k)=1\gcd(A_i,k)=1 for every integer ii such that 1iN1 \le i \le N.

Constraints

  • All values in input are integers.
  • 1N,M1051 \le N,M \le 10^5
  • 1Ai1051 \le A_i \le 10^5

Input

Input is given from Standard Input in the following format:

NN MM

A1A_1 A2A_2 \dots ANA_N

Output

In the first line, print xx: the number of integers satisfying the requirement. In the following xx lines, print the integers satisfying the requirement, in ascending order, each in its own line.

3 12
6 1 5
3
1
7
11

For example, 77 has the properties gcd(6,7)=1,gcd(1,7)=1,gcd(5,7)=1\gcd(6,7)=1,\gcd(1,7)=1,\gcd(5,7)=1, so it is included in the set of integers satisfying the requirement. On the other hand, 99 has the property gcd(6,9)=3\gcd(6,9)=3, so it is not included in that set. We have three integers between 11 and 1212 that satisfy the condition: 11, 77, and 1111. Be sure to print them in ascending order.