#K68367. Two Sum Indices Problem

    ID: 32849 Type: Default 1000ms 256MiB

Two Sum Indices Problem

Two Sum Indices Problem

In this problem, you are given an array of integers and a target value kk. Your task is to determine whether there exist two distinct indices ii and jj (1-based indexing) such that the sum of the elements at these indices equals kk, i.e., $$a_i + a_j = k.$$ If such a pair exists, output "YES" followed by the two indices. Otherwise, output "NO" and -1 for both indices.

Note that if there are multiple solutions, you may output any one of them.

inputFormat

The input is given via standard input. The first line contains two integers nn and kk, where nn is the number of elements in the array, and kk is the target sum. The second line contains nn space-separated integers representing the array elements.

outputFormat

Print a single line to standard output. If a valid pair is found, print "YES" followed by the two 1-based indices separated by spaces. If no such pair exists, print "NO -1 -1".## sample

5 9
1 7 5 3 2
YES 2 5