#P1045B. Space Isaac

    ID: 4409 Type: RemoteJudge 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>hashingnumber theory*2400

Space Isaac

No submission language available for this problem.

Description

Everybody seems to think that the Martians are green, but it turns out they are metallic pink and fat. Ajs has two bags of distinct nonnegative integers. The bags are disjoint, and the union of the sets of numbers in the bags is {0,1,,M1}\{0,1,…,M-1\}, for some positive integer MM. Ajs draws a number from the first bag and a number from the second bag, and then sums them modulo MM.

What are the residues modulo MM that Ajs cannot obtain with this action?

The first line contains two positive integer NN (1N2000001 \leq N \leq 200\,000) and MM (N+1M109N+1 \leq M \leq 10^{9}), denoting the number of the elements in the first bag and the modulus, respectively.

The second line contains NN nonnegative integers a1,a2,,aNa_1,a_2,\ldots,a_N (0a1<a2<<aN<M0 \leq a_1<a_2< \ldots< a_N<M), the contents of the first bag.

In the first line, output the cardinality KK of the set of residues modulo MM which Ajs cannot obtain.

In the second line of the output, print KK space-separated integers greater or equal than zero and less than MM, which represent the residues Ajs cannot obtain. The outputs should be sorted in increasing order of magnitude. If KK=0, do not output the second line.

Input

The first line contains two positive integer NN (1N2000001 \leq N \leq 200\,000) and MM (N+1M109N+1 \leq M \leq 10^{9}), denoting the number of the elements in the first bag and the modulus, respectively.

The second line contains NN nonnegative integers a1,a2,,aNa_1,a_2,\ldots,a_N (0a1<a2<<aN<M0 \leq a_1<a_2< \ldots< a_N<M), the contents of the first bag.

Output

In the first line, output the cardinality KK of the set of residues modulo MM which Ajs cannot obtain.

In the second line of the output, print KK space-separated integers greater or equal than zero and less than MM, which represent the residues Ajs cannot obtain. The outputs should be sorted in increasing order of magnitude. If KK=0, do not output the second line.

Samples

Sample Input 1

2 5
3 4

Sample Output 1

1
2

Sample Input 2

4 1000000000
5 25 125 625

Sample Output 2

0

Sample Input 3

2 4
1 3

Sample Output 3

2
0 2

Note

In the first sample, the first bag and the second bag contain {3,4}\{3,4\} and {0,1,2}\{0,1,2\}, respectively. Ajs can obtain every residue modulo 55 except the residue 22: 4+10,4+21,3+03,3+14 4+1 \equiv 0, \, 4+2 \equiv 1, \, 3+0 \equiv 3, \, 3+1 \equiv 4 modulo 55. One can check that there is no choice of elements from the first and the second bag which sum to 22 modulo 55.

In the second sample, the contents of the first bag are {5,25,125,625}\{5,25,125,625\}, while the second bag contains all other nonnegative integers with at most 99 decimal digits. Every residue modulo 10000000001\,000\,000\,000 can be obtained as a sum of an element in the first bag and an element in the second bag.