description: You are given an array a of n integers, and another integer k such that 2k ≤ n.
  
  You have to perform exactly k operations with this array. In one operation, you have to choose two elements of the array (let them be a_i and a_j; they can be equal or different, but their positions in the array must not be the same), remove them from the array, and add ⌊ (a_i)/(a_j) ⌋ to your score, where ⌊ x/y ⌋ is the maximum integer not exceeding x/y.
  
  Initially, your score is 0. After you perform exactly k operations, you add all the remaining elements of the array to the score.
  
  Calculate the minimum possible score you can get.
  
  Input
  
  The first line of the input contains one integer t (1 ≤ t ≤ 500) — the number of test cases.
  
  Each test case consists of two lines. The first line contains two integers n and k (1 ≤ n ≤ 100; 0 ≤ k ≤ ⌊ n/2 ⌋).
  
  The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 2 ⋅ 10^5).
  
  Output
  
  Print one integer — the minimum possible score you can get.
  
  Example
  
  Input
  
  
  5
  7 3
  1 1 1 2 1 3 1
  5 1
  5 5 5 5 5
  4 2
  1 3 3 7
  2 0
  4 2
  9 2
  1 10 10 1 10 2 7 10 3
  
  
  Output
  
  
  2
  16
  0
  6
  16
  
  Note
  
  Let's consider the example test.
  
  In the first test case, one way to obtain a score of 2 is the following one:
  
    1. choose a_7 = 1 and a_4 = 2 for the operation; the score becomes 0 + ⌊ 1/2 ⌋ = 0, the array becomes [1, 1, 1, 1, 3]; 
    2. choose a_1 = 1 and a_5 = 3 for the operation; the score becomes 0 + ⌊ 1/3 ⌋ = 0, the array becomes [1, 1, 1]; 
    3. choose a_1 = 1 and a_2 = 1 for the operation; the score becomes 0 + ⌊ 1/1 ⌋ = 1, the array becomes [1]; 
    4. add the remaining element 1 to the score, so the resulting score is 2. 
  
  
  
  In the second test case, no matter which operations you choose, the resulting score is 16.
  
  In the third test case, one way to obtain a score of 0 is the following one:
  
    1. choose a_1 = 1 and a_2 = 3 for the operation; the score becomes 0 + ⌊ 1/3 ⌋ = 0, the array becomes [3, 7]; 
    2. choose a_1 = 3 and a_2 = 7 for the operation; the score becomes 0 + ⌊ 3/7 ⌋ = 0, the array becomes empty; 
    3. the array is empty, so the score doesn't change anymore. 
  
  
  
  In the fourth test case, no operations can be performed, so the score is the sum of the elements of the array: 4 + 2 = 6.
solution: 
  import java.util.*;
  import java.io.*;
  
  public class Main {
  
      static int mod = 1000000007;
  
      static void read(int arr[], int start, int end, FastReader in) {
          for (int i = start; i < end; i++) {
              arr[i] = in.nextInt();
          }
      }
  
      static int sumArr(int arr[]) {
          int sum = 0;
          for (int i = 0; i < arr.length; i++) {
              sum += arr[i];
          }
          return sum;
      }
      static final int MAX = 10000000;
  
  // prefix[i] is going to store count
  // of primes till i (including i).
      static int prefix[] = new int[MAX + 1];
  
      static void buildPrefix() {
  
          // Create a boolean array "prime[0..n]". A
          // value in prime[i] will finally be false
          // if i is Not a prime, else true.
          boolean prime[] = new boolean[MAX + 1];
          Arrays.fill(prime, true);
  
          for (int p = 2; p * p <= MAX; p++) {
  
              // If prime[p] is not changed, then
              // it is a prime
              if (prime[p] == true) {
  
                  // Update all multiples of p
                  for (int i = p * 2; i <= MAX; i += p) {
                      prime[i] = false;
                  }
              }
          }
  
          // Build prefix array
          prefix[0] = prefix[1] = 0;
          for (int p = 2; p <= MAX; p++) {
              prefix[p] = prefix[p - 1];
              if (prime[p]) {
                  prefix[p]++;
              }
          }
      }
  
      static int query(int L, int R) {
          return prefix[R] - prefix[L - 1];
      }
  
      static int gcd(int a, int b) {
          if (b == 0) {
              return a;
          }
          return gcd(b, a % b);
      }
      static Long gcd(Long a, Long b) {
          if (b == 0) {
              return a;
          }
          return gcd(b, a % b);
      }
      
      static int min(int arr[]) {
          int min = Integer.MAX_VALUE;
          for (int i = 0; i < arr.length; i++) {
              min = Math.min(min, arr[i]);
          }
          return min;
      }
  
      public static void sort(int[] arr) {
          ArrayList<Integer> ls = new ArrayList<Integer>();
          for (int x : arr) {
              ls.add(x);
          }
          Collections.sort(ls);
          for (int i = 0; i < arr.length; i++) {
              arr[i] = ls.get(i);
          }
      }
  
      static int max(int arr[]) {
          int max = Integer.MIN_VALUE;
          for (int i = 0; i < arr.length; i++) {
              max = Math.max(max, arr[i]);
          }
          return max;
      }
  
      static int max(int a, int b) {
          return Math.max(a, b);
      }
  
      static int min(int a, int b) {
          return Math.min(a, b);
      }
  
      public static boolean isPrime(long n) {
          if (n < 2) {
              return false;
          }
          if (n == 2 || n == 3) {
              return true;
          }
          if (n % 2 == 0 || n % 3 == 0) {
              return false;
          }
          long sqrtN = (long) Math.sqrt(n) + 1;
          for (long i = 6L; i <= sqrtN; i += 6) {
              if (n % (i - 1) == 0 || n % (i + 1) == 0) {
                  return false;
              }
          }
          return true;
      }
  
      static class Pair {
  
          String first;
          int second;
  
          Pair(String f, int s) {
              first = f;
              second = s;
          }
  
          @Override
          public String toString() {
              return "first: " + first + " second: " + second;
          }
      }
  
      static class FastReader {
  
          BufferedReader br;
          StringTokenizer st;
  
          public FastReader() {
              br = new BufferedReader(new InputStreamReader(System.in));
          }
  
          String next() {
              while (st == null || !st.hasMoreTokens()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          double nextDouble() {
              return Double.parseDouble(next());
          }
  
          String nextLine() {
              String str = "";
              try {
                  str = br.readLine().trim();
              } catch (Exception e) {
                  e.printStackTrace();
              }
              return str;
          }
  
          void read(int arr[]) {
              for (int i = 0; i < arr.length; i++) {
                  arr[i] = nextInt();
              }
          }
  
          void read(long arr[]) {
              for (int i = 0; i < arr.length; i++) {
                  arr[i] = nextLong();
              }
          }
      }
  
      static class FastWriter {
  
          private final BufferedWriter bw;
  
          public FastWriter() {
              this.bw = new BufferedWriter(new OutputStreamWriter(System.out));
          }
  
          public void println(Object object) throws IOException {
              print(object);
              bw.append("\n");
          }
  
          public void printarr(int arr[]) throws IOException {
  
              println(Arrays.toString(arr));
          }
  
          public void print(Object object) throws IOException {
              bw.append("" + object);
          }
  
          public void close() throws IOException {
              bw.close();
          }
      }
  
      public int[] prevSmaller(int[] A) {
  //        Stack<Integer> stk=new Stack<>();
          int ans[] = new int[A.length];
          int min = Integer.MAX_VALUE;
          for (int k = 0; k < A.length; k++) {
              int i = A[k];
              if (i <= min) {
                  min = i;
                  ans[k] = -1;
              } else if (i > min) {
                  ans[k] = min;
              }
          }
          return ans;
      }
  
      public static int count(String s, char c) {
          int count = 0;
          for (int i = 0; i < s.length(); i++) {
              if (s.charAt(i) == c) {
                  count++;
              }
          }
          return count;
      }
  
      public static int stoi(String s) {
          return Integer.parseInt(s);
      }
  
      public static String itos(int n) {
          return Integer.toString(n);
      }
  
      public static int ctoi(char c) {
          return (int) c - 48;
      }
  
      public static class Element {
  
          int l, r, x;
  
          Element(int l, int r, int x) {
              this.l = l;
              this.r = r;
              this.x = x;
          }
  
          @Override
          public String toString() {
              return "l: " + l + " r: " + r + " x: " + x + " ";
          }
      }
  
      public static void swap(int arr[], int start, int end) {
          while (start < end) {
              int temp = arr[start];
              arr[start] = arr[end];
              arr[end] = temp;
              start++;
              end--;
          }
      }
  
      public static long pow(int n) {
          long l = 10;
          while (n-- != 0) {
              l *= 10;
          }
          return l;
      }
      static int max1(int arr[], int n, int k){
          int i=n-1;
          int sum=0;
          while(k-- != 0){
              sum+=(arr[i-1]/arr[i]);
              i-=2;
          }
          for(int j=0;j<=i;j++)
              sum+=arr[j];
          return(sum);
      }
      static int max2(int arr[], int n, int k){
          int sum2=0;
          int r=n-1,l=n-k-1;
                      while(k-- != 0){
                          sum2+=(arr[l]/arr[r]);
                          arr[l]=0;arr[r]=0;
  //                        out.println(l+"--"+r);
                          l--;
                          r--;
                      }
                      for(int j=0;j<n;j++)
                          sum2+=arr[j];
           return sum2;
      }
      public static void main(String[] args) {
          try {
              FastReader in = new FastReader();
              FastWriter out = new FastWriter();
              int tc = in.nextInt();
              while (tc-- != 0) {
                  int n=in.nextInt();
                  int k=in.nextInt();
                  int arr[]=new int[n];
                  in.read(arr);
                  sort(arr);
                  out.println(min(max1(arr,n,k),max2(arr,n,k)));
              }
              out.close();
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  