atcoder#ARC141D. [ARC141D] Non-divisible Set

[ARC141D] Non-divisible Set

Score : 700700 points

Problem Statement

We say that a set SS of positive integers is good when, for any a, bS (ab)a,\ b \in S\ (a\neq b), bb is not a multiple of aa.

You are given a set of NN integers between 11 and 2M2M (inclusive): S={A1, A2, , AN}S=\lbrace A_1,\ A_2,\ \dots,\ A_N\rbrace.

For each i=1, 2, , Ni=1,\ 2,\ \dots,\ N, determine whether there exists a good set with MM elements that is a subset of SS containing AiA_i.

Constraints

  • MN2MM \leq N \leq 2M
  • 1M3×1051 \leq M \leq 3 \times 10^5
  • 1A1<A2<<AN2M1 \leq A_1 < A_2 < \dots < A_N \leq 2M
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

A1A_1 A2A_2 \dots ANA_{N}

Output

Print NN lines. The ii-th line should contain Yes if there exists a good set with MM elements that is a subset of SS containing AiA_i, and No otherwise.

5 3
1 2 3 4 5
No
Yes
Yes
Yes
Yes

Trivially, the only good set containing A1=1A_1=1 is {1}\lbrace 1\rbrace, which has just one element, so the answer for i=1i=1 is No.

There is a good set {2, 3, 5}\lbrace 2,\ 3,\ 5\rbrace containing A2=2A_2=2, so the answer for i=2i=2 is Yes.

4 4
2 4 6 8
No
No
No
No
13 10
2 3 4 6 7 9 10 11 13 15 17 19 20
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No