logo AlgoBeat OnlineJudge
登录 注册

#213541. [COCI 2012/2013 #4] RAZLIKA

内存限制:64 MiB 时间限制:500 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Mirko's newest math homework assignment is a very difficult one! Given a sequence, , of integers, remove exactly of them from the sequence. Let be the largest difference of any two remaining numbers in the sequence, and the smallest such difference. Select the integers to be removed from in such a way that the sum is the smallest possible. Mirko isn't very good at math, so he has asked you to help him!

输入格式

The first line of input contains two positive integers, () and ().

The second line of input contains space-separated positive integers – the sequence ().

输出格式

The first and only line of output must contain the smallest possible sum .

样例

样例输入 1

5 2
-3 -2 3 8 6

样例输出 1

7

样例输入 2

6 2
-5 8 10 1 13 -1

样例输出 2

13

样例输入 3

6 3
10 2 8 17 2 17

样例输出 3

6