Problem Statement
Given an array of
integers
, as well as an integer
, determine the sum of the subarray which has a sum which is less than or equal to
. There will always be a subarray with a sum of
. If there is no subarray with sum less than or equal to
then output
.
Remember that a subarray is a selection of continuous elements of .
Input Format
Your first line will contain two space-separated integers and
.
Your next line will contain
space-separated integers
.
Output Format
You should output the largest subarray sum less than or equal to . If there is no subarray with sum less than or equal to
then output
.
Constraints
## Sample Cases
Input 1
6 13
100 -4 2 7 2 5
Output 1
12
Explanation 2
The subarray with sum of is
.
Input 2
5 5
1 2 -4 2 5
Output 2
5
Explanation 2
The subarray with sum of is
.
Comments