Coders here is a simple task for you, you have given an array of size **N** and an integer **M**.

Your task is to calculate the **difference between maximum sum and minimum sum of N-M elements** of the given array.

**Constraints:**

**1<=t<=10**

**1<=n<=1000**

**1<=a[i]<=1000**

**Input:**

First line contains an integer **T** denoting the number of testcases.

First line of every testcase contains two integer **N** and **M**.

Next line contains **N** space separated integers denoting the elements of array

**Output:**

For every test case print your answer in new line

Explanation

M is 1 and N is 5 so you have to calculate maximum and minimum sum using (5-1 =) 4 elements.

Maximum sum using the 4 elements would be (2+3+4+5=)14.

Minimum sum using the 4 elements would be (1+2+3+4=)10.

Difference will be 14-10=4.

Time Limit:
1.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
Bash,
C,
C++,
C++14,
C++17,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
Java 14,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
Python 3.8,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift-4.1,
Swift,
TypeScript,
Visual Basic

Initializing Code Editor...

{"38becb6": "/pagelets/problem-author-tester/algorithm/min-max-difference/", "6641b0c": "/pagelets/show-submission/algorithm/min-max-difference/", "5906ea3": "/pagelets/problems-hint/algorithm/min-max-difference/", "14d7665": "/pagelets/recommended-problems/algorithm/min-max-difference/"}