PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000122. Liệt kê số nguyên tố cùng nhau (Coprime 2)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Liệt kê số nguyên tố cùng nhau (Coprime 2)

Coprime 2

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given nn positive integers a1,…,ana_1,\ldots,a_n and a positive integer mm, list every integer kk in [1,m][1,m] such that gcd⁡(k,ai)=1\gcd(k,a_i)=1 for every i=1,…,ni=1,\ldots,n. Print the valid integers in increasing order.

Input

The first line contains n,mn,m. The second contains nn numbers aia_i.

Output

Print the count xx on the first line. On each of the next xx lines, print one valid number in ascending order.

Subtasks

  • Subtask 1 (20 points): 1≤n≤301\le n\le 30; 1≤m≤301\le m\le 30; 1≤ai≤1001\le a_i\le 100.
  • Subtask 2 (30 points): 1≤n≤5 0001\le n\le 5\,000; 1≤m≤5 0001\le m\le 5\,000; 1≤ai≤10 0001\le a_i\le 10\,000.
  • Subtask 3 (50 points): 1≤n≤100 0001\le n\le 100\,000; 1≤m≤100 0001\le m\le 100\,000; 1≤ai≤100 0001\le a_i\le 100\,000.

Examples

Input

3 12
6 1 5

Output

3
1
7
11

Explanation

Among integers from 1 to 12, only 1, 7 and 11 are coprime to all of 6, 1 and 5. For instance, 9 is excluded because gcd⁡(6,9)=3\gcd(6,9)=3.