Difference
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Walk_alone has a sequence a of length n, he defines function f as
        

He thinks that calculating the value of the function to a given interval is too boring, so he wants you to output the k-th largest value of the function among all f(l,r) where .

输入描述:

The first line contains  and , where n indicates the length of sequence a.

The second line contains n integers as the sequence.

输出描述:

Output a single value indicating the k-th largest function value among all intervals.
示例1

输入

复制
3 2
3 1 2

输出

复制
4