#include #include #include #include #include #include #include #define ll __int64 #define ull unsigned long long #define INF 99999999 using namespace std; int n, m; ll a[101000]; void getData() { scanf("%d%d", &n, &m); for (int i = 1; i <= n - 1; i++) scanf("%I64d", &a[i]); } void solve() { ll sum = 0; sort(a + 1, a + n); for (int i = 1; i <= n - m; i++) sum += a[i]; sum += n; printf("%I64d\n", sum); } int main() { int t; scanf("%d", &t); while (t--) { getData(); solve(); } return 0; }