Quokka Pairs

Program time limit: 1 second

Program memory limit: 512 MB

$N$ quokkas are performing a dance together!

Each quokka has been given a score, $A_i$ based on how well they danced!

At the end of the dance, judges are handing out a special prize, which belongs to a pair of Quokkas whose scores add up to a certain score $K$.

Your job is to see if this pair exists! Output 'Y' if there exists a pair that can receive prizes, otherwise output 'N'.

Input

  • The first line of input contains two integers $N$, representing the number of quokka dancers, and $K$, representing the score that a pair of Quokkas needs to add up to to win the special prize.
  • The second line contains $N$ integers, $A_1,\dots , A_N$, represeting the scores of each quokka.

Constraints

For all test cases:

  • $1 \le N \le 1000$,
  • $0 \le K \le 10^9$,
  • $0 \le A_i \le 10^9$ for $1 \le i \le N$.

Additionally:

  • For Subtask 1 (50% of points): $K$ is guaranteed odd.
  • For Subtask 2 (50% of points): there are no additional constraints.

Output

  • Output 'Y' if there exists a pair that can receive prizes, otherwise output 'N'.

Templates

You should read from standard input and write to standard output.

In Python, you could use the following code.

# Taking inputs, already done! :D
N, K = map(int, input().split())
A = list(map(int, input().split()))

flag = False
# Write your code here


# Printing output
if flag:
    print("Y")
else:
    print("N")

In C or C++, you could use the following code.

// Taking inputs, already done! :D
int N, K; scanf("%d%d", &N, &K);
int A[N]; for (int i = 0; i < N; i++) scanf("%d", &A[i]);

bool flag;
// Write your code here


// Printing output
if (flag == true) {
    printf("Y\n");
} else {
    printf("N\n");
}

Sample Input 1

7 67
41 6 7 9 26 4 1

Sample Output 1

Y

Explanation 1

In this case, K is 67, so quokka dancers with the scores 41 and 26 can add up to K, winning their special prize.

Scoring

For each subtask (worth 50% and 50% of points, as per the Constraints section), your program will be run on multiple secret test cases one after another, and if it produces the correct output for all test cases, it solves that subtask. Your program will receive the points for each subtask it solves. Recall that your final score on the task is the score of your highest scoring submission.


Submit

Log in to submit!