Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tags yet

No tag edit access

F. Array Covering

time limit per test

3 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputMisha has an array of integers of length *n*. He wants to choose *k* different continuous subarrays, so that each element of the array belongs to at least one of the chosen subarrays.

Misha wants to choose the subarrays in such a way that if he calculated the sum of elements for each subarray, and then add up all these sums, the resulting value was maximum possible.

Input

The first line of input contains two integers: *n*, *k* (1 ≤ *n* ≤ 100 000, 1 ≤ *k* ≤ *n*·(*n* + 1) / 2) — the number of elements in the array and the number of different subarrays that must be chosen.

The second line contains *n* integers *a*_{i} ( - 50 000 ≤ *a*_{i} ≤ 50 000) — the elements of the array.

Output

Output one integer — the maximum possible value Misha can get by choosing *k* different subarrays.

Example

Input

5 4

6 -4 -10 -4 7

Output

11

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/13/2017 14:03:12 (c6).

Desktop version, switch to mobile version.

User lists

Name |
---|