#include<bits/stdc++.h>
#define int long long
#define Aqrfre(x, y) freopen(#x ".in", "r", stdin),freopen(#y ".out", "w", stdout)
#define th2 second
#define th1 first
#define mp make_pair
#define Type int
#define qr(x) x=read()
typedef long long ll;
using namespace std;
inline Type read(){
char c=getchar(); Type x=0, f=1;
while(!isdigit(c)) (c=='-'?f=-1:f=1), c=getchar();
while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48), c=getchar();
return x*f;
}
const int N = 205;
int n, m, T, a[N];
priority_queue<int>s;
signed main(){ // a
// Aqrfre(a, a);
qr(T);
for(int th=1; th<=T; th++){
qr(n); qr(m);
for(int i=1; i<=n; i++) qr(a[i]);
sort(a+1, a+1+n);
while(s.size()) s.pop();
int ans = 0;
for(int i=2; i<=n; i++){
ans += a[i] - a[i-1];
s.push(a[i] - a[i-1]);
}
int cnt = 0;
while(s.size()){
if(cnt == m - 1) break;
ans -= s.top();
cnt++; s.pop();
}
printf("Case #%lld: %lld\n", th, ans);
}
return 0;
}