#C9441. Contiguous Subarray Sum Problem
Contiguous Subarray Sum Problem
Contiguous Subarray Sum Problem
Given an array of integers \(a_1, a_2, \ldots, a_N\) and an integer \(K\), determine whether there exists a contiguous subarray whose sum is exactly \(K\). In other words, check if there exist indices \(i\) and \(j\) with \(1 \le i \le j \le N\) such that
If such a subarray exists, output Yes
; otherwise, output No
.
inputFormat
The input is given via standard input (stdin). The first line contains two space-separated integers (N) and (K). The second line contains (N) space-separated integers denoting the elements of the array.
outputFormat
Output a single line to standard output (stdout) containing Yes
if there exists a contiguous subarray whose sum is (K), otherwise output No
.## sample
5 15
1 2 3 4 5
Yes