Brick Tower

Time limit: 0.1s Memory limit: 256MB Input: Output:

There are NN children in Luca’s kindergarten, numbered from 00 to N1N −1. Child ii (for each i=0,1,,N1i = 0, 1, \dots , N −1) has a toy brick with height HiH_i.

Today, Luca asked the children to build a tower of height SS. To do so, some of the children may stack their bricks on top of one another so that the total height of the selected bricks is exactly SS.

However, the children prefer to keep their bricks for themselves. For each child, determine whether their brick is indispensable. That is, whether it is impossible to build a tower of height S without using that child’s brick.

Input data

The first line of the input file contains two integers: NN and SS, respectively the number of children and the height of the tower to build.

The second line of the input file contains NN integers: H0,H1,,HN1H_0, H_1, \dots , H_{N−1}, the heights of the bricks.

Output data

The output file must contain NN lines, each consisting of a single string: the ii-th line must be YES if the brick of child ii is indispensable, and NO otherwise.

Constraints and clarifications

  • 1N30001 \leq N \leq 3000.
  • 1S30001 \leq S \leq 3000.
  • 1HiS1 \leq H_i \leq S for each i=0,1,,N1i = 0, 1, \dots , N − 1.
  • There is at least one way to build a tower of height SS using some of the bricks.
# Score Constraints
1 0 Examples.
2 22 N15N \leq 15.
3 35 N100N \leq 100.
4 43 No additional constraints.

Example 1

stdin

3 7
3 4 4

stdout

YES
NO
NO

Explanation

In the first sample case, the only ways to build a tower of height 77 is to use the brick of child 00 combined with one of the other children’s bricks. Therefore, only the brick of child 00 is indispensable.

Example 2

stdin

5 10
5 1 4 2 2

stdout

YES
YES
NO
NO
NO

Explanation

In the second sample case, it can be proven that only the brick of child 00 and child 11 is indispensable.

Log in or sign up to be able to send submissions!