Coprime 2
Xem dạng PDF
Gửi bài giải
Điểm:
5,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
512M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
Reference: AtCoder ABC215 D — Coprime 2
You are given a sequence of ~N~ positive integers:
~A_1, A_2, \ldots, A_N~
Find every integer ~k~ between ~1~ and ~M~, inclusive, such that:
~gcd(A_i, k) = 1~
for every ~i~ from ~1~ to ~N~.
Input
- The first line contains two integers ~N~ and ~M~.
- The second line contains ~N~ integers: ~A_1, A_2, \ldots, A_N~.
Output
- First, print the number ~x~ of integers satisfying the condition.
- Then print these ~x~ integers in increasing order, one integer per line.
Constraints
- ~1 \le N, M \le 10^5~
- ~1 \le A_i \le 10^5~
- All input values are integers.
Example 1
Input:
3 12
6 1 5
Output:
3
1
7
11
Bình luận