#include <stdio.h>
#include <string.h>
int main() {
int T;
scanf("%d", &T);
while (T--) {
int N, k;
scanf("%d %d", &N, &k);
char num[105];
scanf("%s", num);
int keep = N - k;
char result[105]; // To store the final number
int top = -1;
for (int i = 0; i < N; i++) {
char current = num[i];
// Pop smaller digits from the result if possible
while (top >= 0 && result[top] < current && k > 0) {
top--;
k--;
}
result[++top] = current; // Push current digit to result
}
result[keep] = '\0'; // Null-terminate only first (N - k) digits
// Remove leading zeros (optional, problem doesn't mention)
int start = 0;
while (start < keep && result[start] == '0') start++;
if (start == keep)
printf("0\n"); // All zeros
else
printf("%s\n", result + start);
}
return 0;
}