#K36512. Subarray Sum Check

    ID: 25771 Type: Default 1000ms 256MiB

Subarray Sum Check

Subarray Sum Check

You are given an array of n integers and an integer k. Your task is to determine whether there exists a contiguous subarray whose sum is exactly k. In other words, find indices l and r (with 0 ≤ l ≤ r < n) such that

$$\sum_{i=l}^{r} a_i = k$$

The array can contain both positive and negative integers. If such a subarray exists, output True; otherwise, output False.

inputFormat

The first line contains two integers: n (the number of elements in the array) and k (the target sum).

The second line contains n space-separated integers representing the array.

outputFormat

Output a single line with either True if there exists a contiguous subarray that sums to k, or False otherwise.

## sample
5 12
1 2 3 7 5
True

</p>