|All-time Popular Problems|
|Construct Tree from Inorder & Preorder|
|Sum of two large numbers|
|Level order traversal in spiral form|
|Spirally traversing a matrix|
|Angle between hour and minute hand|
|Binary Tree to DLL|
|Smallest Positive missing number|
|Height of Binary Tree|
|Largest Number formed from an Array|
Given an array. The task is to choose K numbers from the array such that the absolute difference between the sum of chosen numbers and the sum of remaining numbers is maximum.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains two integers N and K and the second line contains N space separated array elements.
For each test case, print the maximum absolute difference in new line.
8 4 5 2 10
1 1 1 1 1 1 1 1