double s;n,k,i,y;d['   '];c(int*z){i=*1[&z]-*z;}main(x){for(scanf("%*d");~scanf("%d%d%d",&n,&k,&y);printf("%.f\n",s)){for(i=--n;i;y=x)scanf("%d",&x),d[--i]=x-y;qsort(d,n,4,c);for(s=0;n>=k;s+=d[--n]);}}