You are given a string $s$ consisting of $n$ lowercase Latin letters. Polycarp wants to remove exactly $k$ characters ($k \le n$) from the string $s$. Polycarp uses the following algorithm $k$ times:

  if there is at least one letter 'a', remove the leftmost occurrence and stop the algorithm, otherwise go to next item;  if there is at least one letter 'b', remove the leftmost occurrence and stop the algorithm, otherwise go to next item;  ...  remove the leftmost occurrence of the letter 'z' and stop the algorithm. 

This algorithm removes a single letter from the string. Polycarp performs this algorithm exactly $k$ times, thus removing exactly $k$ characters.

Help Polycarp find the resulting string.


-----Input-----

The first line of input contains two integers $n$ and $k$ ($1 \le k \le n \le 4 \cdot 10^5$) — the length of the string and the number of letters Polycarp will remove.

The second line contains the string $s$ consisting of $n$ lowercase Latin letters.


-----Output-----

Print the string that will be obtained from $s$ after Polycarp removes exactly $k$ letters using the above algorithm $k$ times.

If the resulting string is empty, print nothing. It is allowed to print nothing or an empty line (line break).


-----Examples-----
Input
15 3
cccaabababaccbc

Output
cccbbabaccbc

Input
15 9
cccaabababaccbc

Output
cccccc

Input
1 1
u

Output

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
(b, c) = input().split()
c = int(c)
stroka = input()
n = 26
spisok = [0] * n
for i in stroka:
	spisok[ord(i) - 97] += 1
stroka = stroka[::-1]
for i in range(0, len(spisok)):
	if c > 0:
		if int(spisok[i]) >= c:
			spisok[i] = int(spisok[i]) - c
			c = 0
		elif (int(spisok[i]) < c) & (int(spisok[i]) > 0):
			c = c - spisok[i]
			spisok[i] = 0
stroka_f = ''
for i in stroka:
	if spisok[ord(i) - 97] > 0:
		stroka_f += i
		spisok[ord(i) - 97] -= 1
print(stroka_f[::-1])


def main():
	(n, k) = map(int, input().split())
	(l, abc) = (list(input()), 'abcdefghijklmnopqrstuvwxyz')
	d = {c: [] for c in abc}
	for (i, c) in enumerate(l):
		d[c].append(i)
	for c in abc:
		for i in d[c]:
			l[i] = ''
			k -= 1
			if not k:
				print(''.join(l))
				return
main()


(n, k) = map(int, input().split())
s = input()
hash = [0] * 256
for i in range(n):
	hash[ord(s[i])] += 1
str = 'abcdefghijklmnopqrstuvwxyz'
i = 0
while k > 0:
	if hash[ord(str[i])] >= k:
		s = s.replace(str[i], '', k)
		k = 0
	else:
		k = k - hash[ord(str[i])]
		s = s.replace(str[i], '')
		i = i + 1
print(s)


(n, k) = map(int, input().split())
s = input()
cnt = [0 for i in range(26)]
for i in range(n):
	cnt[ord(s[i]) - ord('a')] += 1
tk = k
for i in range(26):
	if tk >= cnt[i]:
		tk -= cnt[i]
	else:
		cnt[i] = tk
		tk = 0
for c in s:
	if cnt[ord(c) - ord('a')] > 0:
		cnt[ord(c) - ord('a')] -= 1
	else:
		print(c, end='')


(n, k) = map(int, input().split())
s = input()
alp = 'abcdefghijklmnopqrstuvwxyz'
for a in alp:
	if k == 0:
		break
	if s.count(a) <= k:
		k -= s.count(a)
		s = s.replace(a, '')
	else:
		s = s.replace(a, '', k)
		k = 0
print(s)


from string import ascii_lowercase
l1 = str(input())
l2 = str(input())
length = int(l1.split(' ')[0])
remove = int(l1.split(' ')[1])
counts = []
for c in ascii_lowercase:
	counts.append(l2.count(c))
sum_ind = 0
alpha_ind = 0
for c in counts:
	if sum_ind + c < remove:
		l2 = l2.replace(ascii_lowercase[alpha_ind], '', c)
		alpha_ind += 1
		sum_ind += c
	else:
		removeable = 0
		if sum_ind + c >= remove:
			removeable = remove - sum_ind
		else:
			removeable = c
		l2 = l2.replace(ascii_lowercase[alpha_ind], '', removeable)
		alpha_ind += 1
		break
print(l2)


(n, k) = map(int, input().strip().split())
s = input()
l = n
i = 97
while k != 0 and i < 123:
	c = chr(i)
	s = s.replace(c, '', k)
	nl = len(s)
	k -= l - nl
	l = nl
	i += 1
print(s)


(n, k) = list(map(int, input().split(' ')))
string = list(input())
my_dict = {}
for letter in string:
	if letter in my_dict:
		my_dict[letter] = my_dict[letter] + 1
	else:
		my_dict[letter] = 1
for i in range(ord('a'), ord('z') + 1):
	key = chr(i)
	if key not in my_dict:
		continue
	if k <= 0:
		my_dict[key] = 0
	elif my_dict[key] > k:
		my_dict[key] = k
		k -= my_dict[key]
	else:
		k -= my_dict[key]
for letter in string:
	if my_dict[letter] > 0:
		my_dict[letter] -= 1
	else:
		print(letter, end='')


(n, k) = map(int, input().split())
a = list(input())
d = [0 for i in range(27)]
for i in a:
	d[ord(i) - ord('a')] += 1
s = [0 for i in range(27)]
for i in range(27):
	if k - d[i] >= 0:
		s[i] = d[i]
		k -= d[i]
	else:
		s[i] = k
		k = 0
	if k == 0:
		break
for i in a:
	if s[ord(i) - ord('a')] == 0:
		print(i, end='')
	else:
		s[ord(i) - ord('a')] -= 1


(n, k) = map(int, input().split())
s = input()
l = []
for i in range(n):
	l.append((s[i], i))
l.sort(key=lambda x: x[0])
ans = ''
x = l[k:]
x.sort(key=lambda x: x[1])
for (i, j) in x:
	ans += i
print(ans)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
s = list(input())
d = dict()
for i in range(ord('a'), ord('z') + 1):
	d[chr(i)] = 0
for elem in s:
	d[elem] += 1
for i in range(ord('a'), ord('z') + 1):
	l = chr(i)
	if d[l] < k:
		k -= d[l]
	else:
		break
st = []
count = 0
for elem in s:
	if elem > l:
		st.append(elem)
	elif elem == l:
		if count >= k:
			st.append(elem)
		else:
			count += 1
print(''.join(st))


[n, k] = list(map(int, input().split(' ')))
s = input()
list_s = list(s)
y = [i for i in range(len(list_s))]
zipped = list(zip(list_s, y))
zipped.sort(key=lambda t: t[0])
result = list('*' * n)
for i in range(k, len(zipped)):
	result[zipped[i][1]] = zipped[i][0]
final = ''
for c in result:
	if c != '*':
		final += c
print(final)


def main():
	(n, k) = map(int, input().split())
	(l, abc) = (list(input()), 'abcdefghijklmnopqrstuvwxyz')
	d = {c: [] for c in abc}
	for (i, c) in enumerate(l):
		d[c].append(i)
	for v in map(d.get, abc):
		if len(v) < k:
			for i in v:
				l[i] = ''
			k -= len(v)
		else:
			for i in v[:k]:
				l[i] = ''
			print(''.join(l))
			return
main()


(n, k) = map(int, input().split())
s = list(input())
update = dict()
while k > 0:
	for i in range(26):
		c = chr(i + 97)
		count = s.count(c)
		if count < k:
			update[c] = count
			k -= count
		else:
			update[c] = k
			k = 0
			break
updated_str = []
for i in s:
	if i in update and update[i] > 0:
		update[i] -= 1
		continue
	else:
		updated_str.append(i)
print(''.join(updated_str))


def solve(s, k):
	freq = {}
	ori = {}
	srt = []
	for i in s:
		srt.append(i)
	srt.sort()
	for i in srt:
		if i not in freq:
			freq[i] = 1
			ori[i] = 1
		else:
			freq[i] += 1
			ori[i] += 1
	while k > 0:
		for i in freq.keys():
			while freq[i] > 0 and k > 0:
				freq[i] -= 1
				k -= 1
	answer = ''
	for i in s:
		if freq[i] != ori[i]:
			freq[i] += 1
		else:
			answer += i
	if len(answer) == 0:
		print()
	else:
		print(answer)
inp = input().split()
n = int(inp[0])
k = int(inp[1])
s = input()
solve(s, k)


import sys
import math
import random

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()

def FACT(n, mod):
	s = 1
	facts = [1]
	for i in range(1, n + 1):
		s *= i
		s %= mod
		facts.append(s)
	return facts[n]

def C(n, k, mod):
	return FACT(n, mod) * pow(FACT(k, mod) * FACT(n - k, mod) % mod, mod - 2, mod) % mod
(n, k) = MI()
s = list(SI())
ans = ['' for i in range(n)]
d = [[] for i in range(26)]
for i in range(n):
	x = ord(s[i]) - 97
	d[x].append(i)
for i in range(26):
	if k == 0:
		break
	else:
		m = min(k, len(d[i]))
		l = len(d[i]) - m
		if l == 0:
			d[i] = []
		else:
			d[i] = d[i][-l:]
		k -= m
for i in range(26):
	for j in range(len(d[i])):
		ans[d[i][j]] = chr(i + 97)
print(''.join(ans))


(n, k) = map(int, input().strip().split())
r = input()
r1 = 'abcdefghijklmnopqrstuvwxyz'
l = [[] for i in range(26)]
d = {}
for u1 in range(26):
	d[r1[u1]] = u1
for t in range(n):
	l[d[r[t]]].append(t)
l1 = []
for x in l:
	for y in x:
		l1.append(y)
s = ''
l2 = []
for o in range(k, n):
	l2.append(l1[o])
l2.sort()
for i in l2:
	s = s + r[i]
print(s)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	(n, k) = map(int, input().split())
	s = str(input())
	res = [[] for i in range(26)]
	v = [False] * n
	for i in range(n):
		temp = ord(s[i]) - ord('a')
		res[temp].append(i)
	f = False
	for r in res:
		for x in r:
			if k == 0:
				f = True
				break
			v[x] = True
			k = k - 1
		if f:
			break
	ans = []
	for i in range(n):
		if not v[i]:
			ans.append(s[i])
	print(''.join(ans))
main()


(n, k) = map(int, input().split())
s = input()
l = [0] * 26
for i in s:
	l[ord(i) - 97] += 1
x = list(l)
i = 0
while i < 26 and k != 0:
	if l[i] == 0:
		i += 1
		continue
	if l[i] > k:
		l[i] -= k
		k = 0
	else:
		k -= l[i]
		l[i] = 0
	i += 1
z = ''
for i in range(len(s) - 1, -1, -1):
	if l[ord(s[i]) - 97] > 0:
		z += s[i]
		l[ord(s[i]) - 97] -= 1
print(z[::-1])


(a, b) = map(int, input().split())
s = input()
alph = 'abcdefghijklmnopqrstuvwxyz'
for i in alph:
	cnt = s.count(i)
	s = s.replace(i, '', min(cnt, b))
	b -= cnt
	if b < 1:
		break
print(s)


(k, n) = tuple(map(int, input().split()))
start = 97
l = input()
s = dict()
for i in range(k):
	s[i] = l[i]
s = sorted(s.items(), key=lambda v: v[1])
s = s[n:]
s = dict(s)
s = dict(sorted(s.items(), key=lambda v: v[0]))
for i in s.values():
	print(i, end='')


from collections import defaultdict
from collections import deque
abc = 'abcdefghijklmnopqrstuvwxyz'
(n, k) = input().split()
n = int(n)
k = int(k)
s = input()
d = defaultdict(deque)
for (i, c) in enumerate(s):
	d[c].append(i)
p = 0
for i in range(k):
	while len(d[abc[p]]) == 0:
		p += 1
	d[abc[p]].popleft()
out = [''] * n
for (c, l) in d.items():
	for i in l:
		out[i] = c
print(''.join(out))


p = input().rstrip().split(' ')
s = input().rstrip()
x = list(s)
k = int(p[1])
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
q = []
for i in range(0, len(l)):
	q.append(x.count(l[i]))
for i in range(0, len(q)):
	if int(q[i]) < k:
		k = k - int(q[i])
		q[i] = 0
	elif int(q[i]) == k:
		q[i] = 0
		k = 0
		break
	elif int(q[i]) > k:
		q[i] = int(q[i]) - k
		break
D = []
for i in range(len(x) - 1, -1, -1):
	if q[ord(x[i]) - 97] > 0:
		D.append(x[i])
		q[ord(x[i]) - 97] -= 1
if len(D) != 0:
	D.reverse()
	print(''.join(D))


from operator import itemgetter
(n, k) = map(int, input().split())
s = input()[:n]
charpos = sorted([(ch, i) for (i, ch) in enumerate(s)])[k:]
charpos.sort(key=itemgetter(1))
print(''.join(map(itemgetter(0), charpos)))


(n, k) = input().split()
n = int(n)
k = int(k)
s = input()
l = list(s)
x = 97
item = chr(97)
count = 0
t = n
for i in range(97, 124):
	item = chr(i)
	for j in range(0, n):
		if l[j] == item:
			l[j] = '.'
			count = count + 1
		if count == k:
			break
	if count == k:
		break
for i in range(0, n):
	if l[i] != '.':
		print(l[i], end='')


(n, k) = map(int, input().split())
a = list(input())
x = ord('a')
y = ord('z')
b = [0] * 26
c = [0] * 26
summ = 0
for i in a:
	b[ord(i) - x] += 1
for i in range(26):
	for j in range(b[i]):
		if summ < k:
			c[i] += 1
		summ += 1
for i in range(n):
	if c[ord(a[i]) - x] > 0:
		c[ord(a[i]) - x] -= 1
		a[i] = ''
print(*a, sep='')


from string import ascii_lowercase
from collections import defaultdict
(n, k) = map(int, input().split())
s = input()
mp = defaultdict(list)
for i in range(n - 1, -1, -1):
	mp[s[i]].append(i)
alphabets = [i for i in ascii_lowercase]
temp = [i for i in s]
for i in range(k):
	for j in alphabets:
		if j in mp and len(mp[j]) > 0:
			values = mp[j]
			temp[mp[j][-1]] = -1
			mp[j].pop()
			k -= 1
			break
		if k == 0:
			break
ans = []
for i in temp:
	if i != -1:
		ans.append(i)
print(''.join(ans))


(n, k) = map(int, input().split())
s = input()
h = k
arr = list(s)
arr.sort()
cnt = 1
pr = {}
res = {}
j = 0
for i in range(n - 1):
	if arr[j] == arr[j + 1]:
		cnt = cnt + 1
	else:
		pr[arr[j]] = cnt
		cnt = 1
	j = j + 1
pr[arr[j]] = cnt
for (i, j) in pr.items():
	if k - j > 0:
		res[i] = 0
		k = k - j
	else:
		l = abs(k - j)
		res[i] = l
		k = 0
for (i, j) in pr.items():
	res[i] = j - res[i]
up = []
down = 0
for i in range(len(s)):
	if down != h:
		if res[s[i]] > 0:
			down += 1
			res[s[i]] = res[s[i]] - 1
		else:
			up.append(s[i])
	else:
		up.append(s[i])
print(''.join(up))


A = [int(i) for i in input().split()]
n = A[0]
k = A[1]
S = input()
A = {}
for i in range(26):
	A[chr(97 + i)] = []
for i in range(len(S)):
	A[S[i]].append(i)
for i in range(26):
	A[chr(97 + i)] = A[chr(97 + i)][::-1]
rem = set()
for i in range(26):
	while len(A[chr(97 + i)]) > 0 and k > 0:
		rem.add(A[chr(97 + i)].pop())
		k = k - 1
		if k == 0:
			break
R = ''
for i in range(len(S)):
	if i not in rem:
		R += S[i]
print(R)


from copy import deepcopy
(n, k) = map(int, input().split())
s = input()
a = deepcopy(list(s))
a.sort()
d = {}
for i in a:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
a = list(d.keys())
a.sort()
for i in a:
	if d[i] <= k:
		k -= d[i]
		d[i] = 0
	else:
		d[i] -= k
		k = 0
		break
ans = ''
xyz = deepcopy(s)
for i in xyz[::-1]:
	if d[i]:
		ans += i
		d[i] -= 1
print(ans[::-1])


(n, k) = list(map(int, input().split()))
s = input()
array = [0] * 26
for e in s:
	array[ord(e) - ord('a')] += 1
for i in range(len(array)):
	if k > array[i]:
		k -= array[i]
	else:
		array[i] = k
		k = 0
ans = []
for letter in s:
	if array[ord(letter) - ord('a')]:
		array[ord(letter) - ord('a')] -= 1
	else:
		ans.append(letter)
print(''.join(ans))


(n, k) = map(int, input().split())
s = list(input())
st = 'abcdefghijklmnopqrstuvwxyz'
li = [0] * 26
for i in range(len(st)):
	li[i] = s.count(st[i])
for i in range(len(st)):
	if k > 0 and st[i] in s:
		if li[i] < k:
			k -= li[i]
			li[i] = 0
		elif k <= li[i]:
			li[i] -= k
			k = 0
m = []
for i in range(len(s) - 1, -1, -1):
	if li[st.index(s[i])] > 0:
		m.append(s[i])
		li[st.index(s[i])] -= 1
for i in range(len(m) - 1, -1, -1):
	print(m[i], end='')


import string
(n, k) = [int(i) for i in input().split()]
s = input()
d = {x: 0 for x in string.ascii_lowercase}
for x in s:
	d[x] += 1
r = 'a'
removed = []
for c in string.ascii_lowercase:
	if k - d[c] < 0:
		r = c
		break
	removed.append(c)
	k -= d[c]
s = ''.join([l for l in s if l not in removed])
final = []
for c in s:
	if k == 0 or c != r:
		final.append(c)
	else:
		k -= 1
print(''.join(final))


(N, K) = map(int, input().split())
s = input()
R = [0] * 26
for i in range(N):
	R[ord(s[i]) - ord('a')] += 1
(index, num) = (100, 0)
for i in range(26):
	if K <= R[i]:
		index = i
		num = K
		break
	else:
		K -= R[i]
t = ''
for i in range(N):
	if ord(s[i]) - ord('a') < index:
		continue
	elif ord(s[i]) - ord('a') == index and num > 0:
		num -= 1
	else:
		t += s[i]
print(t)


def calc(n, k, a):
	dic = {}
	lis = []
	val = k
	for i in a:
		if i in dic:
			dic[i] += 1
		else:
			dic[i] = 1
			lis.append(i)
	dic2 = {}
	lis.sort()
	for i in lis:
		if val == 0:
			break
		else:
			dic2[i] = 0
			while dic[i] > 0 and val > 0:
				dic[i] -= 1
				val -= 1
				dic2[i] += 1
	s = ''
	for i in a:
		if i in dic2 and dic2[i] > 0:
			dic2[i] -= 1
		else:
			s += i
	print(s)
(n, k) = list(map(int, input().split()))
a = input()
calc(n, k, a)


(a, b) = map(int, input().split())
z = input()
g = [0] * 26
s = 0
for i in range(26):
	g[i] += z.count(chr(97 + i))
for i in range(26):
	s += g[i]
	if s >= b:
		g[i] -= s - b
		g[i + 1:] = [0] * (26 - i - 1)
		break
for i in range(a):
	if g[ord(z[i]) - 97]:
		g[ord(z[i]) - 97] -= 1
	else:
		print(z[i], end='')


def question3():
	(string_len, remove_left) = map(int, input().split())
	string = input()
	alpha_count = [0 for i in range(26)]
	for character in string:
		alpha_count[ord(character) - 97] += 1
	remove_alpha_upto = [0 for i in range(26)]
	for i in range(26):
		if remove_left >= alpha_count[i]:
			remove_alpha_upto[i] = alpha_count[i]
			remove_left -= alpha_count[i]
		else:
			remove_alpha_upto[i] = remove_left
			remove_left = 0
		if remove_left == 0:
			break
	done_string = ''
	for character in string:
		if remove_alpha_upto[ord(character) - 97] <= 0:
			done_string += character
		else:
			remove_alpha_upto[ord(character) - 97] -= 1
	return done_string
remained_test_cases = 1
while remained_test_cases > 0:
	print(question3())
	remained_test_cases -= 1


def main():
	(n, k) = list(map(int, input().split()))
	if n == k:
		print('')
		return 0
	remd = 0
	l = n - k
	alpha = 'abcdefghijklmnopqrstuvwxyz'
	a = input()
	s = [[0, i, a[i]] for i in range(n)]
	s.sort(key=lambda a: alpha.index(a[2]))
	for i in range(k):
		s[i][0] = 1
	s.sort(key=lambda a: (a[0], a[1]))
	(a, b, c) = zip(*s)
	print(''.join(c[:l]))
	return 0
main()


import sys
input = sys.stdin.readline
from collections import *
(n, k) = map(int, input().split())
s = input()[:-1]
idx = defaultdict(lambda : deque([]))
for i in range(n):
	idx[ord(s[i]) - ord('a')].append(i)
rem = [0] * n
for _ in range(k):
	for i in range(26):
		if len(idx[i]) == 0:
			continue
		rem[idx[i].popleft()] = 1
		break
ans = []
for i in range(n):
	if rem[i] == 0:
		ans.append(s[i])
print(''.join(ans))


import collections
import string
(n, k) = map(int, input().split())
inp = input()
count = collections.Counter(inp)
for letter in string.ascii_lowercase:
	if count[letter] > k:
		count[letter] -= k
		break
	elif count[letter]:
		k -= count[letter]
		count[letter] = 0
res = []
for letter in reversed(inp):
	if count[letter]:
		res.append(letter)
		count[letter] -= 1
print(''.join(reversed(res)))


from collections import *
(n, k) = map(int, input().split())
s = input()
c = Counter(sorted(s))
x = list(c.keys())
y = list(c.values())
for i in range(len(x)):
	if k <= 0:
		break
	elif y[i] <= k:
		s = s.replace(x[i], '', y[i])
		k = k - y[i]
	else:
		s = s.replace(x[i], '', k)
		k = 0
print(s)


(n, repeat) = map(int, input().split())
s = list(input())
k = len(s)
d = {}
for i in range(97, 123):
	x = chr(i)
	d.update({x: ([], [0])})
for i in range(k):
	d[s[i]][0].append(i)
(j, count) = (97, 0)
while True:
	if count == repeat:
		break
	x = chr(j)
	if len(d[x][0]) > 0:
		if len(d[x][0]) == d[x][1][0]:
			j += 1
		else:
			x = chr(j)
			index = d[x][1][0]
			d[x][1][0] = d[x][1][0] + 1
			temp = d[x][0][index]
			s[temp] = ''
			count += 1
	else:
		j += 1
c = ''
for i in s:
	if i == '':
		continue
	c = c + i
print(c)


(n, k) = input().split()
n = int(n)
k = int(k)
s = input()
chars = list(s)
appearances = {}
for i in range(27):
	appearances[chr(97 + i)] = 0
for letter in s:
	appearances[letter] += 1
last_remove = ''
for i in range(27):
	letter = chr(97 + i)
	if appearances[letter] <= k:
		k -= appearances[letter]
		appearances[letter] = 0
		if k == 0:
			break
	else:
		last_remove = letter
		k = appearances[letter] - k
		break
new_s = []
for ch in s:
	if ch == last_remove and appearances[ch] > k:
		appearances[ch] -= 1
	elif appearances[ch] != 0:
		new_s.append(ch)
s = ''.join(new_s)
print(s)


(n, k) = map(int, input().split())
x = input()
a = []
for i in range(97, 123):
	a.append(x.count(chr(i)))
cnt = 0
for j in range(26):
	k -= a[j]
	cnt += 1
	if k < 0:
		k += a[j]
		cnt -= 1
		break
ans = []
for l in range(n):
	if ord(x[l]) == 97 + cnt:
		if k != 0:
			k -= 1
		else:
			ans.append(x[l])
	elif ord(x[l]) > 97 + cnt:
		ans.append(x[l])
print(*ans, sep='')


from sys import stdin

def solve(tc):
	(n, k) = map(int, stdin.readline().split())
	s = stdin.readline().strip()
	dic = {}
	for i in range(n):
		if ord(s[i]) - ord('a') in dic:
			dic[ord(s[i]) - ord('a')] += 1
		else:
			dic[ord(s[i]) - ord('a')] = 1
	e = 0
	while e < 26 and k > 0:
		if e in dic:
			if k >= dic[e]:
				k -= dic[e]
				e += 1
			else:
				break
		else:
			e += 1
	res = ''
	for i in range(n):
		if ord(s[i]) - ord('a') > e:
			res += s[i]
		elif ord(s[i]) - ord('a') == e:
			if k > 0:
				k -= 1
			else:
				res += s[i]
	print(res)
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip()) if LOCAL_TEST else 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


from collections import defaultdict
from string import ascii_lowercase
from sys import stdin, stdout
input = stdin.readline

def main():
	(n, k) = map(int, input().split())
	s = input()
	az = defaultdict(int)
	for c in s:
		az[c] += 1
	to_delete = defaultdict(int)
	for c in ascii_lowercase:
		if k == 0:
			break
		to_delete[c] = min(k, az[c])
		k -= to_delete[c]
	res = []
	for c in s:
		if to_delete[c] > 0:
			to_delete[c] -= 1
		else:
			res.append(c)
	stdout.write(''.join(res))
main()


alp = 'abcdefghijklmnopqrstuvwxyz'
(n, k) = map(int, input().split())
s = list(input())
dic = {}
for i in alp:
	dic[i] = []
ans = [True] * n
for i in range(n - 1, -1, -1):
	dic[s[i]].append(i)
j = 0
while j < 26:
	while k > 0:
		if len(dic[alp[j]]) == 0:
			break
		gh = dic[alp[j]].pop()
		ans[gh] = False
		k -= 1
	j += 1
ans1 = ''
for i in range(n):
	if ans[i] == True:
		ans1 += s[i]
print(ans1)


(n, k) = map(int, input().split())
s = input()
i = ord('a')
while 1:
	km = s.count(chr(i))
	if k - km > 0:
		k -= km
		i += 1
	else:
		break
ss = ''
for j in range(n):
	if ord(s[j]) > i:
		ss += s[j]
	elif ord(s[j]) == i:
		if k > 0:
			k -= 1
		else:
			ss += s[j]
print(ss)


(n, k) = map(int, input().split())
s = input()
ar = [0] * 26
for i in s:
	ar[ord(i) - 97] += 1
pos = 0
while k > 0:
	if ar[pos] != 0:
		ar[pos] -= 1
	else:
		pos += 1
		k += 1
	k -= 1
ans = ''
for j in s[::-1]:
	if ar[ord(j) - 97] == 0:
		continue
	ans = ans + j
	ar[ord(j) - 97] -= 1
print(ans[::-1])


import sys
from collections import Counter
(n, k) = map(int, sys.stdin.readline().split())
s = str(sys.stdin.readline())
i = ord('a')
r = 'a'
j = ord('z')
d = Counter(s)
while k > 0:
	i = ord(r)
	while i <= j:
		if d[chr(i)] > 0:
			r = chr(i)
			break
		i += 1
	count = d[r]
	if k > count:
		k -= count
	else:
		count = k
		k = 0
	s = s.replace(r, '', count)
	d[r] -= count
	i += 1
print(s)


from collections import Counter

def main():
	(n, k) = map(int, input().split())
	(s, abc) = (input(), 'abcdefghijklmnopqrstuvwxyz')
	(cnt, d) = (Counter(s), dict(zip(abc, abc)))
	for c in abc:
		if cnt[c] <= k:
			k -= cnt[c]
			d[c] = ''
		else:
			break
	print(''.join(map(d.get, s)).replace(c, '', k))
main()


[n, k] = list(map(int, input().split()))
s = list(input(''))
alpha = []
MX = 4000010
cnt = [0] * MX
inc = 1
for i in range(97, 97 + 26):
	alpha.append(chr(i))
for i in alpha:
	for j in range(n):
		if s[j] == i:
			cnt[j] = inc
			inc += 1
sol = ''
for i in range(n):
	if cnt[i] > k:
		sol += s[i]
print(sol)


import string
from collections import defaultdict
from collections import deque

def main():
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	s = input()
	ans = list(s)
	d1 = defaultdict(deque)
	for (i, c) in enumerate(s):
		d1[c].append(i)
	for _ in range(k):
		for c in string.ascii_lowercase:
			if c not in d1 or len(d1[c]) == 0:
				continue
			x = d1[c].popleft()
			ans[x] = ''
			break
	print(''.join(ans))
main()


(n, k) = map(int, input().split())
s = input()
i = 0
freq = {}
remove = {}
for i in range(97, 97 + 26):
	freq[chr(i)] = 0
for i in range(97, 97 + 26):
	remove[chr(i)] = 0
for i in range(len(s)):
	freq[s[i]] += 1
for i in range(97, 97 + 26):
	if freq[chr(i)] >= k:
		remove[chr(i)] = k
		break
	else:
		remove[chr(i)] = freq[chr(i)]
		k -= freq[chr(i)]
	if k == 0:
		break
for i in range(len(s)):
	if remove[s[i]] > 0:
		remove[s[i]] -= 1
		continue
	else:
		print(s[i], end='')


(n, k) = map(int, input().split())
print(''.join((x[0] for x in sorted(sorted(zip(input(), range(n)))[k:], key=lambda x: x[1]))))


from string import ascii_lowercase
(n, k) = [int(a) for a in input().split()]
s = input()
freq = {}
for c in ascii_lowercase:
	freq[c] = 0
for c in s:
	freq[c] += 1
counter = 0
removeMe = {}
for c in ascii_lowercase:
	if freq[c] == 0:
		continue
	if counter + freq[c] <= k:
		counter += freq[c]
		removeMe[c] = freq[c]
	elif counter + freq[c] > k:
		removeMe[c] = k - counter
		counter = k
	if counter == k:
		break
output = []
for c in s:
	if c in removeMe:
		removeMe[c] -= 1
		if removeMe[c] == 0:
			del removeMe[c]
	else:
		output.append(c)
print(''.join(output))


(n, k) = map(int, input().split())
s = input()
c = 'abcdefghijklmnopqrstuvwxyz'
for i in c:
	a = s.count(i)
	s = s.replace(i, '', min(a, k))
	k -= a
	if k < 1:
		break
print(s)


from itertools import chain
(n, k) = map(int, input().split())
s = input()
li = [[] for _ in range(26)]
for i in range(n):
	li[ord(s[i]) - ord('a')].append(i)
li = list(chain.from_iterable(li))
li = li[:k]
li = list(set(range(n)) - set(li))
li.sort()
ans = [s[i] for i in li]
print(*ans, sep='')


(n, k) = map(int, input().split())
a = list(sorted(enumerate(input()), key=lambda x: (x[1], x[0])))[k:]
print(''.join([x[1] for x in sorted(a)]))


(n, k) = map(int, input().split())
s = input()
s = list(s)
lis = []
for i in range(len(s)):
	lis.append((s[i], i))
lis.sort()
c = 0
lis = lis[k:]
lis.sort(key=lambda s: s[1])
for i in range(len(lis)):
	print(lis[i][0], end='')


nk = [int(x) for x in input().split()]
n = nk[0]
k = nk[1]
s = input()
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(26):
	c = s.count(alpha[i])
	s = s.replace(alpha[i], '', min(c, k))
	k -= c
	if k < 1:
		break
print(s)


import re
import math
import decimal
import bisect

def read():
	return input().strip()

def iread():
	return int(input().strip())

def viread():
	return list(map(int, input().strip().split()))
from collections import Counter
(n, k) = viread()
s = read()
letters = Counter(s)
for l in sorted(letters.keys()):
	if letters[l] < k:
		s = re.sub(l, '', s)
		k -= letters[l]
	else:
		news = ''
		hits = 0
		for c in s:
			if c == l:
				hits += 1
			if c != l or hits > k:
				news += c
		s = news
		break
print(s)


def inp():
	return map(int, input().split())
(n, k) = inp()
(s, asc) = (input(), ord('a'))
while k:
	c = s.count(chr(asc))
	s = s.replace(chr(asc), '', min(k, c))
	k -= min(k, c)
	asc += 1
print(s)


(n, k) = map(int, input().split())
s = list(input())
u = [0] * 28
a = ord('a')

def ind(ch):
	return ord(ch) - a
for i in s:
	u[ind(i)] += 1
d = []
for i in range(28):
	if u[i] <= k:
		d.append(u[i])
		k -= u[i]
	else:
		d.append(k)
		break
c = len(d)
for i in range(n):
	j = ind(s[i])
	if j < c and d[j] > 0:
		d[j] -= 1
		s[i] = '-'
for i in s:
	if i != '-':
		print(i, end='')


str = input()
tokens = str.split(' ')
n = int(tokens[0])
k = int(tokens[1])
str = input()
letter_dist = {}
for i in range(97, 123):
	letter_dist[chr(i)] = 0
for c in str:
	if c in letter_dist:
		letter_dist[c] = letter_dist[c] + 1
remove_dist = {}
for i in range(97, 123):
	c = chr(i)
	if k > letter_dist[c]:
		remove_dist[c] = letter_dist[c]
	else:
		remove_dist[c] = k
	k -= remove_dist[c]
for c in str:
	if remove_dist[c] == 0:
		print(c, end='')
	else:
		remove_dist[c] = remove_dist[c] - 1


def main():
	from collections import Counter
	(n, k) = map(int, input().split())
	s = list(input())
	d = dict(sorted(Counter(s).items(), key=lambda x: x[0]))
	m = {}
	c = 0
	for (key, value) in d.items():
		m.setdefault(key, 0)
		c = 0
		while d[key] and k:
			d[key] -= 1
			k -= 1
			c += 1
		m[key] = c
		if k <= 0:
			break
	for ch in s:
		if ch in m and m[ch]:
			m[ch] -= 1
			if not m[ch]:
				del m[ch]
			continue
		print(ch, end='')
main()


import sys
from collections import Counter
input = sys.stdin.readline
(n, k) = map(int, input().split())
s = input().rstrip()
cnt_ = Counter(s)
cnt = Counter()
for (key, v) in sorted(cnt_.items()):
	delete = min(k, v)
	k -= delete
	cnt[key] = delete
ans = []
for c in s:
	if cnt[c] > 0:
		cnt[c] -= 1
	else:
		ans.append(c)
print(*ans, sep='')


(n, k) = map(int, input().split())
s = input()
c = 'a'
while k > 0:
	z = s.count(c)
	s = s.replace(c, '', min(z, k))
	if k <= z:
		break
	k -= z
	c = chr(ord(c) + 1)
print(s)


(n, k) = map(int, input().split())
s = input()
if n == k:
	exit()
cnt = [0] * 26
for i in s:
	cnt[ord(i) - ord('a')] += 1
for i in range(26):
	if cnt[i] <= k:
		k -= cnt[i]
		cnt[i] = 0
	else:
		cnt[i] -= k
		break
res = ''
for i in range(n - 1, -1, -1):
	if cnt[ord(s[i]) - ord('a')] == 0:
		continue
	res += s[i]
	cnt[ord(s[i]) - ord('a')] -= 1
print(res[::-1])


a = input()
a = a.split(' ')
k = int(a[1])
b = input()
x = []
for i in b:
	x.append(i)
b = x
A = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
d = []
for i in range(26):
	d.append([])
for i in range(len(b)):
	g = A.index(b[i])
	d[g].append(i)
f = []
for i in d:
	f = f + i
for i in range(k):
	b[f[i]] = ''
print(''.join(b))


al = 'abcdefghijklmnopqrstuvwxyz'
(n, k) = [int(x) for x in input().rstrip().split()]
a = input()
for i in al:
	c = a.count(i)
	a = a.replace(i, '', min(c, k))
	k -= c
	if k < 1:
		break
print(a)


from collections import Counter
import collections

def alphabetic_removals(string, n, k):
	removed = 0
	if n == k:
		string = ''
	else:
		ocurrences = sorted(Counter(string).items())
		for x in ocurrences:
			if k > x[1]:
				string = string.replace(x[0], '', x[1])
				k = k - x[1]
			else:
				string = string.replace(x[0], '', k)
				break
			if removed >= k:
				break
	return string
nk = list(map(int, input().split()))
string = input()
print(alphabetic_removals(string, nk[0], nk[1]))


from itertools import compress
(n, k) = [int(i) for i in input().split()]
w = input()
letters = {}
for i in range(len(w)):
	if not w[i] in letters:
		letters[w[i]] = []
	letters[w[i]].append(i)
deleted = [1] * n
for i in sorted(letters.keys()):
	if k == 0:
		break
	for j in letters[i]:
		if k == 0:
			break
		deleted[j] = 0
		k -= 1
print(''.join(compress(list(w), deleted)))


(n, k) = map(int, input().split())
a = list(zip(list(input()), range(n)))
a = sorted(a, key=lambda t: t[0])[k:]
a.sort(key=lambda t: t[1])
print(''.join((t[0] for t in a)))


yoar = list(map(int, input().split()))
n = yoar[0]
k = yoar[1]
s = input()
dic = {}
arr = []
lar = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in lar:
	dic[i] = []
for i in range(n):
	arr.append(s[i])
for i in range(n - 1, -1, -1):
	dic[s[i]].append(i)
for i in range(k):
	if dic['a'] != []:
		ind = dic['a'].pop()
		arr[ind] = -1
	elif dic['b'] != []:
		ind = dic['b'].pop()
		arr[ind] = -1
	elif dic['c'] != []:
		ind = dic['c'].pop()
		arr[ind] = -1
	elif dic['d'] != []:
		ind = dic['d'].pop()
		arr[ind] = -1
	elif dic['e'] != []:
		ind = dic['e'].pop()
		arr[ind] = -1
	elif dic['f'] != []:
		ind = dic['f'].pop()
		arr[ind] = -1
	elif dic['g'] != []:
		ind = dic['g'].pop()
		arr[ind] = -1
	elif dic['h'] != []:
		ind = dic['h'].pop()
		arr[ind] = -1
	elif dic['i'] != []:
		ind = dic['i'].pop()
		arr[ind] = -1
	elif dic['j'] != []:
		ind = dic['j'].pop()
		arr[ind] = -1
	elif dic['k'] != []:
		ind = dic['k'].pop()
		arr[ind] = -1
	elif dic['l'] != []:
		ind = dic['l'].pop()
		arr[ind] = -1
	elif dic['m'] != []:
		ind = dic['m'].pop()
		arr[ind] = -1
	elif dic['n'] != []:
		ind = dic['n'].pop()
		arr[ind] = -1
	elif dic['o'] != []:
		ind = dic['o'].pop()
		arr[ind] = -1
	elif dic['p'] != []:
		ind = dic['p'].pop()
		arr[ind] = -1
	elif dic['q'] != []:
		ind = dic['q'].pop()
		arr[ind] = -1
	elif dic['r'] != []:
		ind = dic['r'].pop()
		arr[ind] = -1
	elif dic['s'] != []:
		ind = dic['s'].pop()
		arr[ind] = -1
	elif dic['t'] != []:
		ind = dic['t'].pop()
		arr[ind] = -1
	elif dic['u'] != []:
		ind = dic['u'].pop()
		arr[ind] = -1
	elif dic['v'] != []:
		ind = dic['v'].pop()
		arr[ind] = -1
	elif dic['w'] != []:
		ind = dic['w'].pop()
		arr[ind] = -1
	elif dic['x'] != []:
		ind = dic['x'].pop()
		arr[ind] = -1
	elif dic['y'] != []:
		ind = dic['y'].pop()
		arr[ind] = -1
	elif dic['z'] != []:
		ind = dic['z'].pop()
		arr[ind] = -1
flag = 0
for i in arr:
	if i != -1:
		flag = 1
		print(i, end='')
if flag == 1:
	print()


(n, k) = map(int, input().split())
test_list = []
ip = input()
alpha = 'a'
for i in range(0, 26):
	test_list.append(alpha)
	alpha = chr(ord(alpha) + 1)
for i in test_list:
	c = ip.count(i)
	if c < k:
		ip = ip.replace(i, '', c)
		k = k - c
	else:
		ip = ip.replace(i, '', k)
		break
print(''.join(ip))


s = 'abcdefghijklmnopqrstuvwxyz'
(x, n) = map(int, input().split())
q = input()
for i in s:
	q = q.replace(i, '', n)
	n -= x - len(q)
	x = len(q)
	if n == 0:
		exit(print(q))


(_, k) = map(int, input().split())
s = input()
dic = []
letters = 'abcdefghijklmnopqrstuvwxyz'
for i in letters:
	dic.extend([ii for (ii, v) in enumerate(s) if v == i])
foo = set(dic[:k])
print(''.join((char for (i, char) in enumerate(s) if i not in foo)))


import string
(n, k) = map(int, input().split())
s = input()
counts = [0] * 26
for c in s:
	counts[ord(c) - 97] += 1
pocty = [0] * 26
for c in string.ascii_lowercase:
	ind = ord(c) - 97
	res = min(k, counts[ind])
	pocty[ind] += res
	k -= res
	if k == 0:
		break
news = ''
for c in s:
	ind = ord(c) - 97
	if pocty[ind] == 0:
		news += c
	else:
		pocty[ind] -= 1
print(news)


(_, k) = map(int, input().split())
s = input()
for ch in 'abcdefghijklmnopqrstuvwxyz':
	x = s.count(ch)
	if x < k:
		s = s.replace(ch, '', x)
		k -= x
	else:
		s = s.replace(ch, '', k)
		break
print(s)


def main():
	rd = lambda : list(map(int, input().split()))
	(n, k) = rd()
	pairs = list(zip(input(), range(n)))
	pairs.sort()
	i = 0
	while k != 0 and len(pairs) > 0:
		pairs[i] = None
		i += 1
		k -= 1
	ret = [-1] * n
	for j in range(len(pairs)):
		if pairs[j] != None:
			(c, i) = pairs[j]
			ret[i] = c
	for j in range(len(ret)):
		if ret[j] != -1:
			print(ret[j], end='')
	print()
main()


(n, k) = map(int, input().split())
s = input()
d = []
for i in range(len(s)):
	d.append([s[i], i])
d.sort(key=lambda x: x[0])
d = d[k:]
d.sort(key=lambda x: x[1])
ans = []
for i in d:
	ans.append(i[0])
print(*ans, sep='')


from collections import Counter
from string import ascii_lowercase
import sys
(n, k) = map(int, input().split())
line = input()
counter = Counter(line)
if n <= k:
	sys.exit(0)
for letter in ascii_lowercase:
	if letter in counter:
		value = counter[letter]
		if value >= k:
			counter[letter] -= k
			break
		counter[letter] = 0
		k -= value
		continue
new_letter = []
for letter in line[::-1]:
	value = counter[letter]
	if value > 0:
		new_letter.append(letter)
		counter[letter] -= 1
print(''.join(new_letter[::-1]))


def modify(string, f, n):
	modified = []
	for i in range(n - 1, -1, -1):
		if f[ord(string[i]) - ord('a')] > 0:
			modified.append(string[i])
			f[ord(string[i]) - ord('a')] -= 1
	for i in range(len(modified) - 1, -1, -1):
		print(modified[i], end='')

def get_frequency(string, n):
	f = [0] * 26
	for i in range(n):
		f[ord(string[i]) - ord('a')] += 1
	return f

def change_frequency(f, n, k):
	i = 0
	while k > 0:
		if f[i] == 0:
			i += 1
			continue
		else:
			f[i] -= 1
			k -= 1
	return f
(n, k) = list(map(int, input().split()))
string = list(input())
f = get_frequency(string, n)
f = change_frequency(f, n, k)
modify(string, f, n)


n = input().split()
(n, k) = (int(n[0]), int(n[1]))
s = input()
a = [0] * 26
for i in range(len(s)):
	a[ord(s[i]) - 97] += 1
for i in range(26):
	if k <= 0:
		break
	j = a[i]
	a[i] -= k
	if a[i] < 0:
		a[i] = 0
	k -= j
p = ''
for i in range(len(s) - 1, -1, -1):
	if a[ord(s[i]) - 97] > 0:
		a[ord(s[i]) - 97] -= 1
		p += s[i]
print(p[::-1])


from sys import stdin, stdout

def main():
	(line1, line2) = [x for x in stdin.readlines()]
	(string_length, k) = [int(x) for x in line1.split()]
	string = line2.split()[0]
	alphabets = 'a b c d e f g h i j k l m n o p q r s t u v w x y z'.split(' ')
	diction = {}
	remained_letter = ''
	number_i_remained = 0
	results = []
	for i in alphabets:
		diction[i] = 0
	for i in string:
		if i in diction:
			diction[i] += 1
	count = 0
	for i in alphabets:
		count += diction[i]
		if count >= k:
			number_i_remained = count - k
			remained_letter = i
			break
	delete_count = 0
	for i in alphabets:
		if i != remained_letter:
			diction[i] = 0
		else:
			diction[i] -= number_i_remained
			delete_count = diction[i]
			break
	for i in string:
		if diction[i] > 0:
			if i != remained_letter:
				results.append(i)
			elif delete_count == 0:
				results.append(i)
			else:
				delete_count -= 1
	print(''.join(results))
main()


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (fast, lambda : map(int, z().split()))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer, end='\n'):
	stdout.write(str(answer) + end)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
(n, k) = zzz()
arr = fast()
for i in range(97, 123):
	arr = arr.replace(chr(i), '', max(0, k))
	k -= n - len(arr)
	n = len(arr)
print(arr)


from collections import defaultdict
(n, k) = [int(x) for x in input().split()]
s = input()
freq = []
index = 0
for ele in s:
	freq.append([ele, index])
	index += 1
freq = sorted(freq)
freq = freq[k:]
freq = sorted(freq, key=lambda x: x[1])
for entry in freq:
	print(entry[0], end='')


(m, n) = map(int, input().split())
ll = list(input())
s = n
k = 0
Exit = False
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'a':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'b':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'c':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'd':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'e':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'f':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'g':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'h':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'i':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'j':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'k':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'l':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'm':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'n':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'o':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'p':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'q':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'r':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 's':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 't':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'u':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'v':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'w':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'x':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		Exit = True
		for i in ll:
			if i != '1':
				print(i, end='')
		break
	if ll[k] == 'y':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
if Exit is True:
	exit()
while k != m:
	if s == 0:
		break
	if ll[k] == 'z':
		ll[k] = '1'
		s -= 1
	k += 1
k = 0
for i in ll:
	if i != '1':
		print(i, end='')


(n, k) = [int(i) for i in input().split()]
s = [0 for i in range(26)]
t = ''
for i in input():
	t += i
	s[ord(i) - 97] += 1
kar = 0
kol = 0
for i in range(len(s)):
	if k > s[i]:
		kar += 1
		k -= s[i]
	else:
		kol = k
		break
ans = ''
for i in range(n):
	if ord(t[i]) - 97 == kar and kol > 0:
		kol -= 1
	elif ord(t[i]) - 97 == kar:
		ans += t[i]
	if ord(t[i]) - 97 > kar:
		ans += t[i]
print(ans)


(n, k) = map(int, input().split())
s = input().rstrip()
for i in range(ord('a'), ord('z') + 1):
	if k <= 0:
		break
	if s.count(chr(i)) < k:
		k -= s.count(chr(i))
		s = s.replace(chr(i), '')
	else:
		s = s.replace(chr(i), '', k)
		k = 0
print(s)


li = [[] for i in range(26)]
pos = [0 for i in range(26)]
(n, k) = [int(x) for x in input().split()]
s = input()
erased = [False for i in range(n)]
for i in range(n):
	li[ord(s[i]) - ord('a')].append(i)
i = 0
while k > 0:
	k -= 1
	while i < 26 and pos[i] == len(li[i]):
		i += 1
	erased[li[i][pos[i]]] = True
	pos[i] += 1
ans = ''
for i in range(n):
	if erased[i] == False:
		ans += s[i]
print(ans)


(k, n) = map(int, input().split())
s = input()
z = [0] * 26
z2 = [0] * 26
for i in s:
	z[ord(i) - 97] += 1
for i in range(26):
	m = min(n, z[i])
	n -= m
	z2[i] = m
s2 = [''] * len(s)
for i in range(len(s)):
	if z2[ord(s[i]) - 97]:
		z2[ord(s[i]) - 97] -= 1
	else:
		s2[i] = s[i]
print(''.join(s2))


from collections import Counter
al = list('abcdefghijklmnopqrstuvwxyz')
(n, k) = map(int, input().split())
g = input()
s = Counter(g)
for x in sorted(s):
	if k > 0:
		k -= s[x]
		if k < 0:
			s[x] += k
			k = 0
	else:
		s[x] = 0
for x in s:
	g = g.replace(x, '', s[x])
print(g)


(n, k) = map(int, input().split())
s = list(input())
d = {}
for i in range(97, 123):
	d[chr(i)] = []
for i in range(len(s)):
	d[s[i]].append(i)
l = [0] * 26
for i in range(k):
	for j in range(97, 123):
		if l[j - 97] < len(d[chr(j)]):
			s[d[chr(j)][l[j - 97]]] = '0'
			l[j - 97] += 1
			break
for i in range(len(s)):
	if s[i] == '0':
		s[i] = ''
print(''.join(s))


alphabet_low = 'abcdefghijklmnopqrstuvwxyz'
(n, k) = map(int, input().split())
from collections import Counter
s = input()
c = Counter(list(s))
delnum = dict()
for i in alphabet_low:
	hit = c.get(i, 0)
	if k == 0:
		delnum[i] = 0
	elif hit >= k:
		delnum[i] = k
		k = 0
	else:
		delnum[i] = hit
		k -= hit
res = []
for i in range(len(s)):
	if delnum[s[i]] != 0:
		delnum[s[i]] -= 1
	else:
		res.append(s[i])
print(''.join(res))


(n, k) = map(int, input().split())
s = str(input())
t = []
for (x, y) in enumerate(s):
	t.append((y, x))
t.sort()
t = t[k:]
o = sorted(t, key=lambda x: x[1])
ans = ''
for (x, y) in o:
	ans += x
print(ans)


(n, k) = map(int, input().split())
s = input()
dic = {chr(i): 0 for i in range(97, 123)}
for i in range(n):
	dic[s[i]] += 1
key = list(dic.keys())
j = 0
while k > 0:
	k = k - dic[key[j]]
	if k >= 0:
		dic[key[j]] = 0
	else:
		dic[key[j]] = dic[key[j]] - (k + dic[key[j]])
	j += 1
temp = ''
s = s[::-1]
for i in s:
	if dic[i] != 0:
		temp += i
		dic[i] -= 1
print(temp[::-1])


(n, k) = [int(i) for i in input().split()]
s = input()
for i in range(97, 123):
	amount = s.count(chr(i))
	if amount <= k:
		s = s.replace(chr(i), '')
		k -= amount
	else:
		s = s.replace(chr(i), '', k)
		k -= k
	if k == 0:
		break
print(s)


import random
import time

def main():
	(n, k) = list(map(int, input().split()))
	S = input()
	d = dict.fromkeys(set(S))
	for i in d:
		d[i] = []
	for i in range(n):
		d[S[i]].append(i)
	index_S = []
	for i in sorted(list(d.keys())):
		index_S.extend(d[i])
	print(''.join([S[i] for i in sorted(index_S[k:])]))
main()


from collections import Counter
(n, k) = map(int, input().split())
s = input()
cnt = Counter(s)
tot = 0
l = sorted(list(cnt.keys()))
lett = set()
for i in range(len(l)):
	tot += cnt[l[i]]
	lett.add(l[i])
	if tot == k:
		c = 0
		l1 = l[i]
		break
	if tot > k:
		c = cnt[l[i]] - tot + k
		lett.remove(l[i])
		l1 = l[i]
		break
cn = 0
for i in range(n):
	if s[i] in lett:
		print('', end='')
	elif s[i] == l1:
		if cn < c:
			print('', end='')
		else:
			print(s[i], end='')
		cn += 1
	else:
		print(s[i], end='')


tmp = input().split(' ')
n = int(tmp[0])
k = int(tmp[1])
s = list(input())
dic = {chr(ord('a') + x): 0 for x in range(26)}
for i in s:
	dic[i] += 1
x = -1
sum = 0
while sum < k:
	x += 1
	sum += dic[chr(ord('a') + x)]
sum -= dic[chr(ord('a') + x)]
flag = []
for i in s:
	if ord(i) - ord('a') == x:
		if sum < k:
			sum += 1
		else:
			flag.append(i)
	if ord(i) - ord('a') > x:
		flag.append(i)
print(''.join(flag))


import collections

class Solution:

	def solve(self, n, k, string):
		resultString = [ch for ch in string]
		indicesDict = collections.defaultdict(list)
		for (i, ch) in enumerate(string):
			indicesDict[ch].append(i)
		sortedIndicesDict = collections.OrderedDict(sorted(indicesDict.items()))
		removed = 0
		for (ch, indicesList) in sortedIndicesDict.items():
			if removed >= k:
				break
			for index in indicesList:
				if removed < k:
					resultString[index] = ''
					removed += 1
				else:
					break
		return ''.join(resultString)
sol = Solution()
[n, k] = list(map(int, input().strip().split()))
string = input().strip()
print(sol.solve(n, k, string))


from collections import defaultdict
from re import sub
(n, k) = [int(inp) for inp in input().split()]
s = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'
mapping = defaultdict(int)
for char in s:
	mapping[char] += 1
for char in alphabet:
	if k <= 0:
		break
	tmp = min(k, mapping[char])
	k -= tmp
	if tmp != 0:
		s = sub(char, '', s, tmp)
print(s)


import sys
(n, k) = map(int, sys.stdin.readline()[:-1].split(' '))
a = sys.stdin.readline()[:-1]
a = list(a)
l = [0 for i in range(26)]
for i in range(n):
	l[ord(a[i]) - ord('a')] += 1
i = 0
while i < 26:
	if l[i] <= k:
		k -= l[i]
		i += 1
	else:
		break
m = i
for i in range(n):
	if ord(a[i]) - ord('a') > m:
		print(a[i], end='')
	if ord(a[i]) - ord('a') == m:
		if k <= 0:
			print(a[i], end='')
		k -= 1


def main():
	(n, k) = list(map(int, input().split()))
	string = input()
	occ = [0] * 26
	res = []
	for c in string:
		occ[ord(c) - ord('a')] += 1
	for i in range(len(occ)):
		if k == 0:
			occ[i] = 0
		else:
			occ[i] = min(occ[i], k)
			k -= occ[i]
	for c in string:
		if occ[ord(c) - ord('a')] == 0:
			res.append(c)
		else:
			occ[ord(c) - ord('a')] -= 1
	print(''.join(res))
main()


import string
from collections import Counter
(n, k) = [int(i) for i in input().split()]
s = input()
counter = Counter(s)
for char in string.ascii_lowercase:
	delta = min(k, counter[char])
	k -= delta
	counter[char] -= delta
s2 = ''
for char in s[::-1]:
	if counter[char] > 0:
		s2 += char
		counter[char] -= 1
print(s2[::-1])


(tn, tk) = input().split()
n = int(tn)
k = int(tk)
a = input()
vis = []
t = []
for i in range(n):
	t.append((a[i], i))
t.sort()
for i in range(n):
	vis.append(0)
for i in range(k):
	vis[t[i][1]] = 1
for i in range(n):
	if vis[i]:
		continue
	print(a[i], end='')


(n, k) = list(map(int, input().split()))
s = input()
for i in 'abcdefghijklmnopqrstuvwxyz':
	x = s.count(i)
	if x < k:
		s = s.replace(i, '', x)
		k = k - x
	else:
		s = s.replace(i, '', k)
		break
print(s)


(n, k) = map(int, input().split())
l = sorted([[j, i] for (i, j) in enumerate(input())])
s2 = sorted(l[k:], key=lambda x: x[1])
[print(i[0], end='') for i in s2]


(n, k) = [int(x) for x in input().split()]
s = str(input())
d = dict()
for x in s:
	if x in d.keys():
		d[x] += 1
	else:
		d[x] = 1
i = 0
x = 'a'
while i != k and x != chr(ord('z') + 1):
	if x in d.keys():
		t = min(d[x], k - i)
		d[x] -= t
		i += t
	if x not in d.keys() or d[x] == 0:
		x = chr(ord(x) + 1)
ans = ''
for x in range(n - 1, -1, -1):
	if d[s[x]]:
		ans += s[x]
		d[s[x]] -= 1
print(ans[::-1] if len(ans) > 0 else '')


(n, k) = map(int, input().split())
s = input()
s1 = 'abcdefghijklmnopqrstuvwxyz'
d = []
d1 = []
for i in range(n):
	d.append([s[i], i])
d.sort()
for i in range(k, n):
	d1.append([d[i][1], d[i][0]])
d1.sort()
for i in range(len(d1)):
	print(d1[i][1], end='')
print()


(n, k) = map(int, input().split())
str = input()
dictionary = dict(((letter, str.count(letter)) for letter in set(str)))
for item in range(26):
	if k == 0:
		break
	key = chr(item + ord('a'))
	if key in dictionary:
		if dictionary[key] >= k:
			dictionary[key] -= k
			k = 0
			break
		else:
			tmp = dictionary[key]
			dictionary[key] -= k
			k -= tmp
ans = list()
for item in reversed(str):
	if item in dictionary:
		if dictionary[item] > 0:
			dictionary[item] -= 1
			ans.append(item)
print(''.join([x for x in list(reversed(ans))]))


from heapq import heappush, heappop, heapify
(n, k) = map(int, input().split())
s = input()
di = [[] for i in range(26)]
for i in range(n):
	heappush(di[ord(s[i]) - 97], i)
j = 0
flag = 0
s = list(s)
while j < k:
	if di[flag]:
		m = heappop(di[flag])
		s[m] = ''
		j += 1
	else:
		flag += 1
print(''.join(s))


(n, k) = map(int, input().split())
s = input()
c = []
for j in s:
	c.append(j)
d = []
for j in range(26):
	d.append([])
for j in range(len(c)):
	d[ord(c[j]) - 97].append(j)
p = 0
j = 0
while j < 26:
	for i in range(len(d[j])):
		if p == k:
			break
		c[d[j][i]] = ''
		p += 1
	if p == k:
		break
	j += 1
print(''.join(c))


t = input().strip()
t = [int(e) for e in t.split(' ')]
n = t[0]
k = t[1]
s = input()
assert len(s) == n
sum_l = [0 for i in range(26)]
for c in s:
	sum_l[ord(c) - ord('a')] += 1
need_l = [0 for i in range(26)]
for i in range(26):
	if k <= sum_l[i]:
		need_l[i] = k
		break
	else:
		need_l[i] = sum_l[i]
		k -= need_l[i]
result = []
for c in s:
	index = ord(c) - ord('a')
	if need_l[index] > 0:
		need_l[index] -= 1
	else:
		result.append(c)
print(''.join(result))


from string import ascii_lowercase
(n, k) = map(int, input().split())
D = {x: [] for x in ascii_lowercase}
A = input()
for (i, x) in enumerate(A):
	D[x] += [i]
C = set()
for a in ascii_lowercase:
	C.update(D[a][:min([k - len(C), len(D[a])])])
R = []
for i in range(n):
	if not i in C:
		R += [A[i]]
print(''.join(R))


(a, b) = map(int, input().split())
c = input()
d = list()
e = [0] * 26
e1 = [0] * 26
for i in range(len(c)):
	d.append(c[i])
	e[ord(c[i]) - 97] += 1
for i in range(b):
	for j in range(26):
		if e[j] > 0:
			e[j] -= 1
			e1[j] += 1
			break
for i in range(a):
	if e1[ord(c[i]) - 97] < 1:
		print(c[i], end='')
	else:
		e1[ord(c[i]) - 97] -= 1


from collections import defaultdict
(n, k) = [int(x) for x in input().split()]
s = input()
removed = set()
l = defaultdict(list)
for (ind, i) in enumerate(s):
	l[i].append(ind)
if k >= n:
	pass
else:
	while k > 0:
		for char in sorted(l.keys()):
			if k >= len(l[char]):
				for ind in l[char]:
					removed.add(ind)
				k -= len(l[char])
				if k == 0:
					break
			else:
				for ind in l[char][:k]:
					removed.add(ind)
				k = 0
				break
	for (ind, i) in enumerate(s):
		if ind not in removed:
			print(i, end='')


(n, k) = list(map(int, input().split()))
s = input()
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
i = 0
while k > 0 and i < 26:
	if l[i] in s:
		p = s.count(l[i])
		if p > k:
			s = s.replace(l[i], '', k)
			k = 0
		else:
			s = s.replace(l[i], '', p)
			k = k - p
			i += 1
	else:
		i += 1
print(s)


from __future__ import print_function
from queue import Queue
import sys
import math
import os.path

def log(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def ni():
	return map(int, input().split())

def nio(offset):
	return map(lambda x: int(x) + offset, input().split())

def nia():
	return list(map(int, input().split()))

def toString(aList, sep=' '):
	return sep.join((str(x) for x in aList))

def toMapInvertIndex(aList):
	return {k: v for (v, k) in enumerate(aList)}
(n, k) = ni()
s = input()
idSort = sorted(range(n), key=lambda k: s[k])
check = [True] * n
for i in range(k):
	check[idSort[i]] = False
b = ''
for i in range(n):
	if check[i]:
		b += s[i]
print(b)


import math
import random
import time
import heapq

def getIntList():
	return list(map(int, input().split()))

def getTransIntList(n):
	first = getIntList()
	m = len(first)
	result = [[0] * n for _ in range(m)]
	for i in range(m):
		result[i][0] = first[i]
	for j in range(1, n):
		curr = getIntList()
		for i in range(m):
			result[i][j] = curr[i]
	return result
(n, k) = getIntList()
s = input()
d = dict()
for l in s:
	d[l] = d.get(l, 0) + 1
ordA = ord('a')
ordZ = ord('z')
trLeter = ''
count = 0
for i in range(ordA, ordZ + 1):
	l = chr(i)
	x = min(d.get(l, 0), k)
	if x == k:
		trLeter = l
		count = x
		break
	k -= x
ordTr = ord(trLeter)
result = ''
for l in s:
	ordL = ord(l)
	if ordL >= ordTr:
		if ordL == ordTr:
			count -= 1
		if ordL == ordTr and count >= 0:
			continue
		result += l
print(result)


import sys
from collections import Counter
(n, k) = map(int, sys.stdin.readline().split(' '))
s = sys.stdin.readline().strip()

def do():
	al = sorted(set(s))
	count = Counter(s)
	d = 0
	for ch in al:
		(count[ch], d) = (d, d + count[ch])
	res = []
	idx = {}
	for ch in s:
		if ch not in idx:
			idx[ch] = 0
		idx[ch] += 1
		if count[ch] + idx[ch] > k:
			res.append(ch)
	return ''.join(res)
print(do())


(n, k) = map(int, input().split())
string = input()
li = list(enumerate(string))
li.sort(key=lambda x: x[1])
li = li[k:]
li.sort(key=lambda x: x[0])
z = ''
for (x, y) in li:
	z += y
print(z)


(n, k) = map(int, input().split())
s = list(input())
l = []
for i in range(n):
	l.append([s[i], i])
l.sort()
for i in range(k):
	s[l[i][1]] = ''
print(''.join(s))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
t = 'abcdefghijklmnopqrstuvwxyz'
(n, k) = mi()
s = list(input())
d = collections.Counter(s)
for c in t:
	if k > d[c]:
		k -= d[c]
		d[c] = 0
	else:
		d[c] -= k
		break
s = s[::-1]
ans = []
for c in s:
	if d[c] > 0:
		ans.append(c)
		d[c] -= 1
ans = ans[::-1]
print(''.join(ans))


import sys
lines = [line.strip() for line in sys.stdin.readlines()]
(n, k) = list(map(int, lines[0].split(' ')))
s = lines[1].split(' ')[0]
indices = []
char = 'a'
index = -1
letters = {}
for c in s:
	if c in letters:
		letters[c] += 1
	else:
		letters[c] = 1
to_delete = {}
while k > 0:
	if char in letters:
		if letters[char] <= k:
			to_delete[char] = letters[char]
			k -= letters[char]
		else:
			to_delete[char] = k
			k = 0
		del letters[char]
	char = chr(ord(char) + 1)
res = ''
for c in s:
	if c in to_delete and to_delete[c] > 0:
		to_delete[c] -= 1
		continue
	res += c
print(res)


import collections

def solve(string, k):
	hsh = collections.Counter(string)
	ls = sorted(hsh.keys())
	i = 0
	string = list(string)
	while k:
		if hsh[ls[i]] == 0:
			i += 1
		for (j, char) in enumerate(string):
			if ls[i] == char and hsh[ls[i]] > 0 and k:
				string[j] = ''
				hsh[ls[i]] -= 1
				k -= 1
	return ''.join(string)
(n, k) = list(map(int, input().split()))
string = input()
print(solve(string, k))


def removeChar(s, c, counts):
	s = list(s)
	while counts:
		s.remove(c)
		counts -= 1
	s = ''.join(s)
	return s
lol = input()
n = int(lol.split(' ')[0])
k = int(lol.split(' ')[1])
s = input()
men = len(s)
liss = {}
lisu = []
for i in list('abcdefghijklmnopqrstuvwxyz'):
	hehe = s.count(i)
	if hehe > k:
		liss[i] = k
		k = k - hehe
		break
	else:
		liss[i] = -1
		lisu.append(i)
		k = k - hehe
for i in s:
	if i in liss.keys():
		if liss[i] > 0:
			liss[i] -= 1
			if liss[i] <= 0:
				liss.pop(i)
		elif liss[i] == 0:
			print(i, end='')
			liss.pop(i)
	else:
		print(i, end='')
print()


(n, k) = [int(x) for x in input().strip().split(' ')]
s = input().strip()
l = []
for i in range(26):
	l.append([])
for i in range(n):
	if s[i] == 'a':
		l[0].append(i)
	elif s[i] == 'b':
		l[1].append(i)
	elif s[i] == 'c':
		l[2].append(i)
	elif s[i] == 'd':
		l[3].append(i)
	elif s[i] == 'e':
		l[4].append(i)
	elif s[i] == 'f':
		l[5].append(i)
	elif s[i] == 'g':
		l[6].append(i)
	elif s[i] == 'h':
		l[7].append(i)
	elif s[i] == 'i':
		l[8].append(i)
	elif s[i] == 'j':
		l[9].append(i)
	elif s[i] == 'k':
		l[10].append(i)
	elif s[i] == 'l':
		l[11].append(i)
	elif s[i] == 'm':
		l[12].append(i)
	elif s[i] == 'n':
		l[13].append(i)
	elif s[i] == 'o':
		l[14].append(i)
	elif s[i] == 'p':
		l[15].append(i)
	elif s[i] == 'q':
		l[16].append(i)
	elif s[i] == 'r':
		l[17].append(i)
	elif s[i] == 's':
		l[18].append(i)
	elif s[i] == 't':
		l[19].append(i)
	elif s[i] == 'u':
		l[20].append(i)
	elif s[i] == 'v':
		l[21].append(i)
	elif s[i] == 'w':
		l[22].append(i)
	elif s[i] == 'x':
		l[23].append(i)
	elif s[i] == 'y':
		l[24].append(i)
	elif s[i] == 'z':
		l[25].append(i)
m = []
for i in l:
	m += i
v = list(s)
for i in range(k):
	v[m[i]] = -1
for i in v:
	if i != -1:
		print(i, end='')


import string
(n, k) = map(int, input().split())
s = input()
for l in string.ascii_lowercase:
	s = s.replace(l, '', max(0, len(s) - n + k))
print(s)


from collections import Counter
(n, k) = map(int, input().split())
s = input()
for i in range(97, 123):
	if s.count(chr(i)) <= k:
		k -= s.count(chr(i))
		s = s.replace(chr(i), '')
	elif k == 0:
		break
	else:
		s = s.replace(chr(i), '', k)
		break
print(s)


(n, k) = map(int, input().split())
s = input()
d = [0] * 128
for char in s:
	d[ord(char)] += 1
to_remove = [0] * 128
for char in range(128):
	todo = min(k, d[char])
	k -= todo
	to_remove[char] = todo
out = ''
for char in s:
	q = ord(char)
	if to_remove[q] != 0:
		to_remove[q] -= 1
	else:
		print(char, end='')
print()


(n, k) = list(map(int, input().split()))
a = input()
c = []
for i in range(26):
	p = chr(97 + i)
	c.append(a.count(p))
p = 0
i = 0
while p + c[i] < k:
	p += c[i]
	i += 1
q = chr(97 + i)
i = 0
d = []
while i < n:
	if a[i] > q:
		d.append(a[i])
	if a[i] == q:
		if p < k:
			p += 1
		else:
			d.append(a[i])
	i += 1
print(''.join(d))


from collections import Counter
a = list(map(int, input().split()))
s = input()
c = Counter(s)
h = 97
while True:
	if c[chr(h)] < a[1]:
		s = s.replace(chr(h), '', c[chr(h)])
		a[1] -= c[chr(h)]
		h += 1
	else:
		s = s.replace(chr(h), '', a[1])
		break
print(s)


(n, k) = map(int, input().split())
s = list(input())
a = [[] for i in range(26)]
for i in range(n):
	a[ord(s[i]) - ord('a')].append(i)
b = []
for i in a:
	b += i
for i in range(k):
	s[b[i]] = None
for i in s:
	if i != None:
		print(i, end='')


import math

def f(n, mod):
	s = 1
	facts = [1]
	for i in range(1, n + 1):
		s *= i
		s %= mod
		facts.append(s)
	return facts[n]

def C(n, k, mod):
	return f(n, mod) * pow(f(k, mod) * f(n - k, mod) % mod, mod - 2, mod) % mod
(n, k) = map(int, input().split())
s = list(input())
ans = ['' for i in range(n)]
d = [[] for i in range(26)]
for i in range(n):
	x = ord(s[i]) - 97
	d[x].append(i)
for i in range(26):
	if k == 0:
		break
	else:
		m = min(k, len(d[i]))
		l = len(d[i]) - m
		if l == 0:
			d[i] = []
		else:
			d[i] = d[i][-l:]
		k -= m
for i in range(26):
	for j in range(len(d[i])):
		ans[d[i][j]] = chr(i + 97)
print(''.join(ans))


def main():
	[n, k] = map(int, input().split())
	s = input()
	char_idxs = []
	for (idx, c) in enumerate(s):
		char_idxs.append((c, idx))
	char_idxs.sort()
	char_idxs = char_idxs[k:]
	char_idxs.sort(key=lambda cidx: cidx[1])
	lst = [c for (c, idx) in char_idxs]
	print(''.join(lst))
main()


from collections import defaultdict
(MyDict, X, Sentence) = (defaultdict(int), list(map(int, input().split())), input())
Temp = sorted(Sentence)[:X[1]]
for i in Temp:
	MyDict[i] += 1
for i in Sentence:
	if i not in MyDict or MyDict[i] == 0:
		print(i, end='')
	else:
		MyDict[i] -= 1


(n, k) = list(map(int, input().strip().split()))
s = input()
occurences = []
for i in range(26):
	occurences.append([])
if k >= len(s):
	pass
else:
	for i in range(n):
		occurences[ord(s[i]) - 97].append(i)
	to_delete = []
	count = 0
	for occurence in occurences:
		for item in occurence:
			if count == k:
				break
			to_delete.append(item)
			count += 1
	li = list(s)
	for ind in to_delete:
		li[ind] = '1'
	li[:] = (value for value in li if value != '1')
	s = ''.join(li)
	print(s)


(a, b) = map(int, input().split())
z = input()
g = [0] * 26
s = 0
for i in range(26):
	g[i] += z.count(chr(97 + i))
for i in range(26):
	s += g[i]
	if s >= b:
		g[i] -= s - b
		g[i + 1:] = [0] * (26 - i - 1)
		break
for i in range(26):
	z = z.replace(chr(97 + i), '', g[i])
print(z)


(n, k) = map(int, input().split())
s = input()
ls = []
for i in range(n):
	ls.append([s[i], i])
ls.sort()
new_ls = []
for i in range(k):
	new_ls.append(ls[i][1])
new_ls.sort()
t = ''
j = 0
for i in range(n):
	if j < len(new_ls) and i == new_ls[j]:
		j += 1
	else:
		t += s[i]
print(t)


cnts = [[] for _ in range(26)]
ids = 26 * [0]
(n, k) = map(int, input().split())
s = list(input())
for (i, c) in enumerate(s):
	cnts[ord(c) - ord('a')].append(i)
while k:
	for i in range(26):
		if ids[i] < len(cnts[i]):
			s[cnts[i][ids[i]]] = '.'
			ids[i] += 1
			k -= 1
			break
print(''.join(list(filter(lambda x: x != '.', s))))


number_of_testcases = 1
for _ in range(number_of_testcases):
	(len_of_given_str, num_of_letters_to_be_removed) = map(int, input().split())
	given_str = input()
	freq_of_alpha = [0 for i in range(26)]
	for char in given_str:
		freq_of_alpha[ord(char) - 97] += 1
	for i in range(26):
		if freq_of_alpha[i] >= num_of_letters_to_be_removed:
			freq_of_alpha[i] -= num_of_letters_to_be_removed
			break
		else:
			num_of_letters_to_be_removed -= freq_of_alpha[i]
			freq_of_alpha[i] = 0
	resulting_str = []
	for char in range(len_of_given_str - 1, -1, -1):
		char = given_str[char]
		if freq_of_alpha[ord(char) - 97]:
			resulting_str.append(char)
			freq_of_alpha[ord(char) - 97] -= 1
	resulting_str.reverse()
	print(''.join(resulting_str))


alpha = 'abcdefghijklmnopqrstuvwxyz'
(n, k) = [int(z) for z in input().split()]
st = input()
masiq = 26 * [0]
for i in range(n):
	masiq[alpha.find(st[i])] += 1
j = 0
while k > masiq[j]:
	k -= masiq[j]
	j += 1
snew = ''
for i in range(n):
	if alpha.find(st[i]) > j:
		snew += st[i]
	elif alpha.find(st[i]) == j and k > 0:
		k -= 1
	elif alpha.find(st[i]) == j and k <= 0:
		snew += st[i]
print(snew)


n = list(map(int, input().split()))
st = list(input())
freq = {}
ch = 'abcdefghijklmnopqrstuvwxyz'
for i in ch:
	freq[i] = []
for i in range(len(st)):
	freq[st[i]].append(i)
for i in freq:
	for j in freq[i]:
		if n[1] > 0:
			st[j] = '0'
			n[1] -= 1
		else:
			break
	if n[1] <= 0:
		break
for i in st:
	if i != '0':
		print(i, end='')
print()


print((lambda n, k: ''.join(map(lambda a: a[0], sorted(sorted(zip(input(), range(n)))[k:], key=lambda a: a[1]))))(*map(int, input().split())))


(n, k) = input().split()
n = int(n)
k = int(k)
s = input()
s = list(s)
if n == k:
	print('')
else:
	a = []
	for i in range(26):
		a.append([])
	for i in range(n):
		a[ord(s[i]) - 97].append(i)
	for i in a:
		v = 0
		for j in i:
			s[j] = '1'
			k -= 1
			if k == 0:
				v = 1
				break
		if v:
			break
	f = ''
	for i in s:
		if i != '1':
			f += i
	print(f)


lower = [chr(i) for i in range(97, 123)]
temp = input()
l = int(temp.split(' ')[0])
k = int(temp.split(' ')[1])
s = list(input())
m = dict()
for i in range(l):
	m[s[i]] = m.get(s[i], 0) + 1
m = sorted(m.items(), key=lambda d: d[0])
num = 0
for i in range(len(m)):
	num = num + m[i][1]
	if num >= k:
		global splistr
		splistr = m[i][0]
		global left
		left = m[i][1] - num + k
		break
for i in range(l):
	if s[i] == splistr:
		s[i] = '@'
		left = left - 1
		if left == 0:
			break
for i in range(l):
	if s[i] >= splistr:
		print(s[i], end='')


import collections
(n, k) = map(int, input().split())
s = list(input().strip())
f = [0] * n
d = collections.defaultdict(list)
for j in range(n):
	d[s[j]].append(j)
keys = 'abcdefghijklmnopqrstuvwxyz'
for v in keys:
	for g in d[v]:
		if k > 0:
			f[g] = 1
			k = k - 1
v = ''
for j in range(n):
	if f[j] == 0:
		v = v + s[j]
print(v)


(n, k) = map(int, input().split())
s = input()
dic = {}
for i in s:
	if i not in dic:
		dic[i] = 1
	else:
		dic[i] += 1
lst = sorted(dic.items())
for i in lst:
	if k <= 0:
		break
	num = min(k, i[1])
	s = s.replace(i[0], '', num)
	k = k - i[1]
print(s)


d = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
(n, k) = list(map(int, input().split()))
s = input()
a = sorted(s)
x = k
for i in range(n):
	d[a[i]] += 1
	x = x - 1
	if x == 0:
		break
ans = ''
z = 0
for i in range(n):
	if d[s[i]]:
		d[s[i]] = d[s[i]] - 1
		k = k - 1
	else:
		ans = ans + s[i]
	if k == 0:
		z = i + 1
		break
ans = ans + s[z:]
print(ans)


def ints():
	return [int(x) for x in input().split()]
(n, k) = ints()
s = input()
xs = [ord(x) * len(s) + i for (i, x) in enumerate(s)]
srt = sorted(zip(xs, enumerate(s)), key=lambda x: x[0])
srt = sorted(srt[k:], key=lambda x: x[1][0])
print(''.join((x[1][1] for x in srt)))


(n, k) = map(int, input().split())
s = input()
alpha_num = [0] * 26
for i in range(n):
	alpha_num[ord(s[i]) - ord('a')] += 1
target = 0
while k - alpha_num[target] > 0:
	k -= alpha_num[target]
	target += 1
ans = []
for i in range(n):
	if ord(s[i]) - ord('a') > target:
		ans.append(s[i])
	elif ord(s[i]) - ord('a') == target:
		if k > 0:
			k -= 1
		else:
			ans.append(s[i])
if ans != []:
	print(''.join(ans))


(n, k) = map(int, input().split())
s = input()
D = {}
alpha = 'abcdefghijklmnopqrstuvwxyz'
L = [0] * n
if n <= k:
	print()
elif k == 0:
	print(s)
else:
	ans = ''
	for i in range(26):
		l = []
		D[alpha[i]] = l
	for i in range(len(s)):
		cc = s[i]
		D[cc].append(i)
	K = 0
	f = True
	for i in sorted(D):
		l1 = D[i]
		for j in range(len(l1)):
			zz = l1[j]
			if L[zz] == 0:
				L[zz] = 1
				K += 1
			if K == k:
				f = False
				break
		if f == False:
			break
	for i in range(n):
		if L[i] == 0:
			ans += s[i]
	print(ans)


from collections import defaultdict, Counter
removed_letters = set()
positions = defaultdict(list)
alphabet = list('abcdefghijklmnopqrstuvwxyz')

def algo():
	while True:
		letter = alphabet[0]
		if len(positions[letter]) != 0:
			removed_letters.add(positions[letter].pop(0))
			return
		else:
			alphabet.pop(0)

def main():
	(n, k) = (int(s) for s in input().strip().split(' '))
	line = input()
	idx = 0
	for char in line:
		positions[char].append(idx)
		idx += 1
	if n == k:
		return ''
	for letter in alphabet:
		if len(positions[letter]) > 0:
			count = len(positions[letter])
			removed_letters.update(positions[letter][:min(k, count)])
			k -= count
			if k <= 0:
				break
	res = ''
	idx = 0
	for char in line:
		if idx not in removed_letters:
			res += char
		idx += 1
	return res
print(main())


from collections import Counter as cc
(n, k) = list(map(int, input().split()))
s = input()
c = cc(s)
alpha = 'abcdefghijklmnopqrstuvwxyz'
for a in alpha:
	if k > c[a]:
		k -= c[a]
		c[a] = 0
	else:
		c[a] -= k
		k = 0
	if k == 0:
		break
lst = []
for a in s[::-1]:
	if c[a] > 0:
		c[a] -= 1
		lst.append(a)
print(''.join(lst[::-1]))


from collections import Counter

def main():
	(n, k) = map(int, input().split())
	s = input()
	cnt = Counter(s)
	for c in (chr(ord('a') + i) for i in range(26)):
		if cnt[c] > 0:
			s = s.replace(c, '', min(k, cnt[c]))
			k -= cnt[c]
			if k < 1:
				break
	print(s)
main()


def runC(data):
	n = int(data[0])
	k = int(data[1])
	s = data[2]
	if n == 1 and k == 1:
		return ''
	alphabe = sorted(set(s))
	for alpha in alphabe:
		count = s.count(alpha)
		if count > k:
			s = s.replace(alpha, '', k)
			k += -k
		else:
			s = s.replace(alpha, '')
			k += -count
		if k == 0:
			break
	return s
data = input().split()
data.append(input())
print(runC(data))


import collections
(n, k) = map(int, input().split())
s = input()
ss = [[s[i], i] for i in range(n)]
ss.sort()
ss = sorted(ss[k:], key=lambda x: x[1])
ans = [x[0] for x in ss]
print(''.join(ans))


(n, k) = list(map(int, input().split()))
a = list(input().strip())
count = [0] * 26
aaa = ord('a')
for i in a:
	count[ord(i) - aaa] += 1
deletables = -1
for i in range(26):
	if count[i] >= k:
		count = k
		ele = i
		break
	deletables = i
	k -= count[i]
ans = ''
for i in a:
	if ord(i) - aaa <= deletables:
		continue
	if chr(ele + aaa) == i:
		if count > 0:
			count -= 1
		else:
			ans += i
	else:
		ans += i
print(ans)


p = input()
p = p.split()
k = int(p[1])
q = input()
i = 'a'
while 1:
	c = q.count(i)
	if c < k:
		q = q.replace(i, '')
		k -= c
		i = ord(i)
		if i == 122:
			break
		i += 1
		i = chr(i)
	else:
		q = q.replace(i, '', k)
		break
print(q)


import sys, collections as cc
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n, k) = I()
s = list(input())
te = []
ns = [''] * n
for i in range(n):
	te.append([s[i], i])
te.sort(key=lambda x: x[0])
te = te[k:]
te.sort(key=lambda x: x[1])
ans = ''
for i in te:
	ans += i[0]
print(ans)


(n, k) = list(map(int, input().split()))
arr = sorted(list(zip(input(), range(n))))[k:]
arr.sort(key=lambda a: a[1])
for i in arr:
	print(i[0], end='')


(n, k) = map(int, input().split())
string = list(input())
test = []
if n != k:
	test = [(i, c) for (i, c) in enumerate(string)]
	test.sort(key=lambda a: a[1])
	test = test[k:]
	test.sort(key=lambda a: a[0])
	print(''.join([v for (_, v) in test]))


(n, k) = map(int, input().split())
s = input()
sl = []
m = {}
for i in range(n):
	m[s[i]] = m.setdefault(s[i], 0) + 1
	sl += [s[i]]
abc = 'abcdefghijklmnopqrstuvwxyz'
c = 0
for i in range(26):
	if abc[i] in m:
		if m[abc[i]] < k:
			k -= m[abc[i]]
		else:
			c = i
			break
abc = abc[c:]
for i in sl:
	if i in abc:
		if abc[0] == i and k > 0:
			k -= 1
			continue
		print(i, end='')
print()


(n, k) = map(int, input().split())
col = list(input())
v = sorted(((x, index) for (index, x) in enumerate(col)))
for i in range(k):
	col[v[i][1]] = ''
print(''.join(col))


import sys, string
(n, k) = map(int, sys.stdin.readline().split())
arr = list(sys.stdin.readline().rstrip())
res = dict().fromkeys(list(string.ascii_lowercase))
check = [True] * n
for i in res:
	res[i] = []
for i in range(n):
	res[arr[i]].append(i)
for i in res:
	if k <= 0:
		break
	for j in res[i]:
		if k <= 0:
			break
		check[j] = False
		k -= 1
ans = []
for i in range(n):
	if check[i]:
		ans.append(arr[i])
print(''.join(ans))


(n, k) = list(map(int, input().split(' ')))
s = str(input())
alphabet = 'abcdefghijklmnopqrstuvwxyz'
from collections import defaultdict

def main(n, k):
	if n == k:
		print('')
		return
	else:
		charMap = defaultdict(int)
		for char in s:
			charMap[char] += 1
		fullRemove = []
		for char in alphabet:
			if charMap[char] <= k:
				k -= charMap[char]
				fullRemove.append(char)
			else:
				break
		partialCharRemove = alphabet[len(fullRemove)]
		new = ''
		for char in s:
			if char in fullRemove:
				pass
			elif char == partialCharRemove and k != 0:
				k -= 1
			else:
				new += char
		print(new)
main(n, k)


(n, k) = map(int, input().split())
s = input()
letters = [0] * 26
for elem in s:
	letters[ord(elem) - ord('a')] += 1
for i in range(26):
	if k > letters[i]:
		k -= letters[i]
		letters[i] = 0
	else:
		letters[i] -= k
		break
ans = ''
s = s[::-1]
for elem in s:
	if letters[ord(elem) - ord('a')] > 0:
		ans += elem
		letters[ord(elem) - ord('a')] -= 1
ans = ans[::-1]
print(ans)


import sys
from bisect import insort, bisect_right
data = sys.stdin.readlines()
lis = []
for line in data:
	lis.append(line)

def dadd(key, elm, dic):
	if key in dic:
		dic[key] += 1
	else:
		dic[key] = 1
	return dic
alphabet = 'abcdefghijklmnopqrstuvwxyz'
(n, k) = list(map(int, lis[0].split()))
string = list(lis[1])
if string[-1] == '\n':
	string = string[:-1]
bol_string = [1] * len(string)
if n - k == 1:
	indices = {char: 0 for char in alphabet}
	for i in range(n):
		indices[string[i]] += 1
	indices = sorted(list(indices.items()), key=lambda x: x[0])
	indices = [tup for tup in indices if tup[1] != 0]
	print(indices[-1][0])
	sys.exit()
indices = {char: [0, []] for char in alphabet}
for i in range(n):
	indices[string[i]][1].append(i)
for char in alphabet:
	if k == 0:
		break
	length = len(indices[char][1])
	if k >= length:
		k -= length
		for i in range(length):
			j = indices[char][0]
			ind = indices[char][1][j]
			indices[char][0] += 1
			bol_string[ind] = 0
	elif k < length:
		for i in range(k):
			j = indices[char][0]
			ind = indices[char][1][j]
			indices[char][0] += 1
			bol_string[ind] = 0
		k = 0
	else:
		print('WTF')
result = ''.join([string[i] for i in range(n) if bol_string[i]])
print(result)


s = 'abcdefghijklmnopqrstuvwxyz'
(n, m) = [int(x) for x in input().split()]
s = input()
s2 = sorted(s)
s2 = s2[:m]
d = {}
for i in s:
	d[i] = 0
for i in s2:
	d[i] += 1
ss = ''
for i in range(n):
	p = s[i]
	if d[p] > 0:
		d[p] -= 1
	else:
		ss += s[i]
print(ss)


R = lambda : map(int, input().split())
(n, k) = R()
s = input()
f = [0] * 26
for i in s:
	f[ord(i) - ord('a')] += 1
p = n - k
for i in reversed(range(26)):
	if f[i] <= p:
		p -= f[i]
		f[i] = 0
	else:
		f[i] -= p
		break
for i in s:
	if f[ord(i) - ord('a')] == 0:
		print(i, end='')
	else:
		f[ord(i) - ord('a')] -= 1


(n, k) = [int(x) for x in input().split()]
s = input()
a = []
for i in s:
	a.append(i)
d = [0] * 26
for i in s:
	d[ord(i) - 97] += 1
v = [0] * 26
for i in range(26):
	if d[i] <= k:
		v[i] += d[i]
		k -= d[i]
	else:
		v[i] = min(d[i], k)
		k = 0
	if k == 0:
		break
ans = ''
for i in s:
	if v[ord(i) - 97] != 0:
		v[ord(i) - 97] -= 1
	else:
		ans += i
print(ans)


(n, k) = map(int, input().split())
s = list(input())
cnt = {}
d = {}
for (i, c) in enumerate(s):
	if c not in cnt:
		cnt[c] = 1
		d[c] = [i]
	else:
		cnt[c] += 1
		d[c].append(i)
ch = ''
for c in sorted(cnt):
	if k - cnt[c] <= 0:
		ch = c
		break
	for i in d[c]:
		s[i] = ''
	k -= cnt[c]
for i in d[ch][:k]:
	s[i] = ''
print(''.join(s))


let = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
cont = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
q = input().split()
(tam, num) = (int(q[0]), int(q[1]))
pala = list(input())
for i in pala:
	cont[let.index(i)] += 1
for j in range(len(cont)):
	if num >= cont[j]:
		num = num - cont[j]
		cont[j] = 0
	else:
		cont[j] = cont[j] - num
		num = 0
		break
palaN = ''
for k in range(len(pala) - 1, -1, -1):
	if cont[let.index(pala[k])] > 0:
		palaN += pala[k]
		cont[let.index(pala[k])] -= 1
print(palaN[::-1])


(n, k) = map(int, input().split())
s = input()
na = ord('a')
va = chr(na)
st = ''
while k != 0:
	p = s.count(va)
	if k > p:
		s = s.replace(str(va), '.')
		k -= p
	else:
		c = 0
		i = 0
		while i < n:
			if s[i] == va and k > 0:
				st += '.'
				k -= 1
			else:
				st += s[i]
			i += 1
	na = na + 1
	va = chr(na)
for x in st:
	if x != '.':
		print(x, end='')


(n, k) = list(map(int, input().split()))
a = list(input())
count = {}
al = 'abcdefghijklmnopqrstuvwxyz'
for i in a:
	count[i] = count.get(i, 0) + 1
ind = []
s = set(a)
s = list(s)
s.sort()
for i in s:
	if len(ind) >= k:
		break
	for j in range(len(a)):
		if a[j] == i:
			ind.append(j)
for i in range(k):
	a[ind[i]] = ''
print(''.join(a))


from sys import stdin, stdout
from math import gcd, ceil, sqrt
from collections import Counter
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(n, k) = iia()
s = is1()
d = {}
for i in range(n):
	d.setdefault(s[i], []).append(i)
for i in sorted(d):
	if len(d[i]) <= k:
		k -= len(d[i])
		d[i] = []
	elif len(d[i]) >= k:
		d[i] = d[i][k:]
		k = 0
	if k == 0:
		break
res = [''] * n
for i in d:
	for j in d[i]:
		res[j] = i
print(''.join(res))


from sys import stdin, stdout
from collections import Counter
(a, b) = map(int, stdin.readline().split())
s = stdin.readline()
sree = 'abcdefghijklmnopqrstuvwxyz'
shan = [[] for i in range(26)]
for i in range(a):
	t = ord(s[i]) - ord('a')
	shan[t].append(i)
c = [1] * a
cnt = 0
siri = 0
for i in range(26):
	for j in shan[i]:
		c[j] = 0
		cnt += 1
		if cnt == b:
			siri = 1
			break
	if siri:
		break
mps = ''
for i in range(a):
	if c[i]:
		mps += s[i]
stdout.write(str(mps))


from collections import defaultdict

def read_nums():
	return [int(x) for x in input().split()]

def main():
	(n, k) = read_nums()
	s = input()
	d = defaultdict(list)
	for i in range(n):
		d[s[i]].append(i)
	removed = set()
	for ch in 'abcdefghijklmnopqrstuvwxyz':
		for index in d[ch]:
			if len(removed) == k:
				break
			removed.add(index)
	res = []
	for i in range(n):
		if i not in removed:
			res.append(s[i])
	print(''.join(res))
main()


from collections import Counter

def chars2remove(s, k):
	cnt = Counter(s)
	chars = [chr(ord('a') + i) for i in range(26)]
	res = Counter()
	for _ in range(k):
		for c in chars:
			if cnt[c] > 0:
				cnt[c] -= 1
				res[c] += 1
				break
	return res

def main():
	(n, k) = map(int, input().split())
	s = list(input())
	cnt = chars2remove(s, k)
	res = []
	for c in s:
		if cnt[c] > 0:
			cnt[c] -= 1
		else:
			res.append(c)
	print(''.join(res))
main()


(n, k) = map(int, input().split())
s = input()
dp = [0 for i in range(30)]
for i in s:
	dp[ord(i) - 97] += 1
summ = dp[0]
x = 1
while summ < k:
	summ += dp[x]
	x += 1
let = x - 1
dif = dp[let] - (summ - k)
for i in s:
	if ord(i) - 97 == let:
		if dif == 0:
			print(i, end='')
		else:
			dif -= 1
	elif ord(i) - 97 > let:
		print(i, end='')


(n, k) = map(int, input().split())
s = input()
alphabets = 'abcdefghijklmnopqrstuvwxyz'
j = 0
for i in alphabets:
	j = s.count(i)
	s = s.replace(i, '', min(j, k))
	k -= j
	if k < 1:
		break
print(s)


(n, k) = map(int, input().split())
if k != n:
	a = input()
	(s, w) = ([0] * 26, ord('a'))
	for q in a:
		s[ord(q) - w] += 1
	(sum1, ind1) = (0, 'a')
	for q in range(26):
		if sum1 + s[q] > k:
			ind1 = chr(w + q)
			sum1 = k - sum1
			break
		sum1 += s[q]
	for q in a:
		if q > ind1:
			print(q, end='')
		elif q == ind1 and sum1 > 0:
			sum1 -= 1
		elif q == ind1:
			print(q, end='')
print()


numbers = list(map(int, input().split()))
n = numbers[0]
k = numbers[1]
str1 = str(input())
str2 = ''
l1 = [0 for i in range(26)]
for i in str1:
	l1[ord(i) - 97] += 1
for i in range(26):
	if k >= l1[i]:
		k -= l1[i]
		str1 = str1.replace(chr(i + 97), '')
	else:
		str1 = str1.replace(chr(i + 97), '', k)
		break
if str2 == '':
	print(str1)
else:
	print(str2)


(n, k) = map(int, input().split(' '))
s = input()
z = 1
l = [0] * 26
for i in range(0, len(s)):
	l[ord(s[i]) - 97] = l[ord(s[i]) - 97] + 1
for i in range(0, 26):
	c = chr(97 + i)
	z = 1
	if k == 0:
		break
	if s.find(c) != -1:
		if l[i] <= k and l[i] != 0:
			s = s.replace(c, '', l[i])
			z = z + l[i] - 1
			k = k - z
		else:
			s = s.replace(c, '', k)
			z = z + k - 1
			k = k - z
if n != len(s):
	print(s)


(n, k) = list(map(int, input().split()))
s = str(input())
if n == k:
	print()
else:
	s = list(s)
	cht = list(map(chr, range(97, 123)))
	l = []
	for i in range(26):
		cn = s.count(cht[i])
		l.append(cn)
	for i in range(26):
		if k >= l[i]:
			k -= l[i]
		else:
			pos = i
			break
	ans = ''
	for i in range(n):
		ind = cht.index(s[i])
		if ind > pos or (ind == pos and k == 0):
			ans += s[i]
		elif ind == pos:
			k -= 1
	print(ans)


(n, k) = map(int, input().split())
s = input()
D = dict()
ch = 'a'
for i in range(26):
	D[ch] = 0
	ch = chr(ord(ch) + 1)
for sym in s:
	D[sym] += 1
to_del = dict()
ch = 'a'
r = k
for i in range(26):
	if D[ch] < r:
		to_del[ch] = D[ch]
	else:
		to_del[ch] = r
	r = r - to_del[ch]
	ch = chr(ord(ch) + 1)
	if r == 0:
		break
ans = [1] * n
for i in range(len(ans)):
	if s[i] in to_del.keys() and to_del[s[i]] > 0:
		to_del[s[i]] -= 1
		ans[i] = 0
answer = ''
for i in range(len(ans)):
	if ans[i] == 1:
		answer += s[i]
print(answer)


(n, k) = map(eval, input().split())
s = input()
cnt = []
for i in range(26):
	cnt.append(0)
for i in s:
	cnt[ord(i) - ord('a')] += 1
i = 0
while k > 0:
	if k >= cnt[i]:
		k -= cnt[i]
		cnt[i] = 0
	else:
		cnt[i] = -k
		k = 0
	i += 1
for i in s:
	index = ord(i) - ord('a')
	if cnt[index] > 0:
		print(i, end='')
	elif cnt[index] < 0:
		cnt[index] += 1
		if cnt[index] == 0:
			cnt[index] = 1


(n, k) = map(int, input().split())
s = input()
line = []
t = ''
letter = [0] * 26
for x in s:
	letter[ord(x) - 97] += 1
d = 0
for x in range(26):
	if d + letter[x] < k:
		d += letter[x]
	else:
		c = chr(x + 97)
		delta = k - d
		break
z = 0
for x in s:
	if x < c:
		pass
	elif x == c:
		if z < delta:
			z += 1
		else:
			t = t + x
	else:
		t = t + x
print(t)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def binary_search(lb, ub, val, cnt):
	mid = (lb + ub) // 2
	if val < mid:
		ub = mid - 1
		binary_search(lb, ub, val, cnt - 1)
	elif val > mid:
		lb = mid + 1
		binary_search(lb, ub, val, cnt - 1)
	else:
		print(cnt)

def abs(x):
	return x if x >= 0 else -x
for t in range(1):
	(n, k) = list(map(int, input().split()))
	string = input()
	if k != n:
		cnt = []
		for i in range(n):
			cnt.append((string[i], i + 1))
		cnt.sort()
		cnt = cnt[k:]
		cnt.sort(key=lambda x: x[1])
		for i in cnt:
			print(i[0], end='')
		print('')


(n, k) = map(int, input().split())
s = input()
t = []
for i in range(len(s)):
	t.append([i, s[i]])
t.sort(key=lambda x: x[1])
t = t[k:]
t.sort()
s = ''
for j in t:
	s += j[1]
print(s)


import string
(n, k) = map(int, input().split())
s = list(input())
i = 0
for char in string.ascii_lowercase:
	for j in range(len(s)):
		if i == k:
			break
		elif s[j] == char:
			s[j] = ''
			i += 1
print(''.join(s))


(n, k) = map(int, input().split())
s = input()
alth = 'abcdefghijklmnopqrstuvwxyz'
chars = [0] * 26
chars2 = [0] * 26
for i in range(n):
	chars[alth.find(s[i])] += 1
for i in range(26):
	if k <= 0:
		break
	chars2[i] = min(chars[i], k)
	k -= chars[i]
for i in range(n):
	if chars2[alth.find(s[i])] == 0:
		print(s[i], end='')
	else:
		chars2[alth.find(s[i])] -= 1


(n, k) = map(int, input().split())
s = list(input())
m = ''
alf = list('abcdefghijklmnopqrstuvwxyz')
gas = {}
for el in alf:
	if el in s:
		gas[el] = min(k, s.count(el))
		k -= s.count(el)
		if k <= 0:
			break
for el in s:
	if not el in gas or gas[el] == 0:
		m += el
	else:
		gas[el] -= 1
print(m)


from collections import defaultdict
counter = defaultdict(int)
(n, k) = tuple(map(lambda x: int(x), input().split()))
s = list(input())
for i in s:
	counter[i] += 1
counter2 = {}
for i in counter:
	counter2[i] = counter[i]
t = k
x = [chr(ord('a') + i) for i in range(26)]
i = 0
while i < len(x) and t > 0:
	if t >= counter[x[i]]:
		t -= counter[x[i]]
		counter[x[i]] = 0
	else:
		counter[x[i]] -= t
		t = 0
	i += 1
i = 0
while i < n:
	if counter2[s[i]] != counter[s[i]]:
		counter2[s[i]] -= 1
		s[i] = ''
	i += 1
print(''.join(s))


from string import ascii_lowercase
from collections import Counter, OrderedDict

def go():
	(n, k) = (int(i) for i in input().split(' '))
	s = [i for i in input()]
	if n <= k:
		return ''
	c = dict(Counter(s))
	new = OrderedDict()
	t = 0
	for i in ascii_lowercase:
		if i in c:
			if c[i] + t <= k:
				new[i] = c[i]
				t += c[i]
			else:
				new[i] = k - t
				break
			if t == k:
				break
	i = 0
	t = k
	while i < n and k != 0:
		if s[i] in new and new[s[i]] > 0:
			new[s[i]] -= 1
			s[i] = 0
			k -= 1
		i += 1
	return ''.join((i for i in s if i != 0))
print(go())


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(n, k) = value()
s = input()
C = Counter(s)
need = defaultdict(int)
for i in ALPHA:
	if C[i] <= k:
		k -= C[i]
		need[i] = C[i]
	else:
		need[i] = k
		k = 0
ans = []
for i in s:
	if need[i]:
		need[i] -= 1
		continue
	else:
		ans.append(i)
print(*ans, sep='')


from collections import Counter
(n, k) = list(map(int, input().split()))
s = input()
dic = Counter(s)
rdic = {}
for ele in sorted(dic):
	if k > dic[ele]:
		rdic[ele] = dic[ele]
		k -= dic[ele]
	else:
		rdic[ele] = k
		break
ans = []
for letter in s:
	if letter not in rdic:
		ans.append(letter)
	else:
		rdic[letter] -= 1
		if rdic[letter] == 0:
			del rdic[letter]
print(''.join(ans))


from collections import defaultdict
(n, m) = map(int, input().split())
s = input()
mp = defaultdict(int)
for i in s:
	mp[i] += 1
cnt = defaultdict(int)
mk = 'abcdefghijklmnopqrstuvwxyz'
for i in mk:
	if mp[i] == 0:
		continue
	cnt[i] += min(m, mp[i])
	m -= min(m, mp[i])
	if m == 0:
		break
for i in s:
	if cnt[i] > 0:
		cnt[i] -= 1
	else:
		print(i, end='')


(n, k) = list(map(int, input().split()))
a = str(input())
if n != k:
	b = []
	for i in range(n):
		b.append([ord(a[i]), i])
	b.sort()
	b = b[k:].copy()
	a = [''] * n
	for i in b:
		a[i[1]] = chr(i[0])
	fini = ''.join(a)
	print(fini)
else:
	print()


(n, k) = map(int, input().split())
s = sorted(sorted(list(zip(input(), range(n))))[k:], key=lambda x: x[1])
for i in s:
	print(i[0], end='')


from collections import Counter
from string import ascii_lowercase
(n, k) = map(int, input().split())
t = input().strip()
ds = Counter(t)
for cur_d in ascii_lowercase:
	if ds[cur_d] <= k:
		t = t.replace(cur_d, '')
		k -= ds[cur_d]
	else:
		break
t = t.replace(cur_d, '', k)
print(t)


(n, k) = map(int, input().split())
ss = input()
li1 = list(ss)
li2 = list(li1)
li3 = []
for i in range(n):
	a = [li2[i], i]
	li3.append(a)
li3.sort()
for i in range(k):
	kaj = li3[i]
	var1 = kaj[1]
	li1[var1] = ''
outp = ''.join(li1)
print(outp)


from bisect import bisect
from collections import defaultdict
from math import gcd, sqrt, ceil
from collections import Counter
(n, k) = map(int, input().split())
s = list(input())
hash = [0] * 130
la = [0] * 130
for (j, i) in enumerate(s):
	hash[ord(i)] += 1
	la[ord(i)] += 1
for i in range(k):
	for j in range(97, 97 + 26):
		if hash[j] != 0:
			hash[j] -= 1
			break
for i in range(len(s)):
	if la[ord(s[i])] != hash[ord(s[i])]:
		la[ord(s[i])] -= 1
		s[i] = ''
print(''.join(s))


n = 0
k = 0

def reducedString(s: str):
	alphabetList = []
	index = 0
	while index < 26:
		alphabetList.append(0)
		index += 1
	index = 0
	while index < n:
		alphabetList[ord(s[index]) - ord('a')] += 1
		index += 1
	charsDeleted = 0
	index = 0
	while charsDeleted < k:
		if alphabetList[index] > 0:
			toBeDeleted = min(k - charsDeleted, alphabetList[index])
			charsDeleted += toBeDeleted
			alphabetList[index] -= toBeDeleted
		index += 1
	index = n - 1
	resultList = []
	while index > -1:
		if alphabetList[ord(s[index]) - ord('a')] > 0:
			resultList.append(s[index])
			alphabetList[ord(s[index]) - ord('a')] -= 1
		index -= 1
	l = 0
	r = len(resultList) - 1
	while l < r:
		tmp = resultList[l]
		resultList[l] = resultList[r]
		resultList[r] = tmp
		l += 1
		r -= 1
	res = ''.join(resultList)
	return res
(n, k) = map(int, input().split())
s = input()
res = reducedString(s)
print(res)


import sys, math
from collections import Counter
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
a = ord('a')
(n, k) = inpl()
s = input()
c = Counter(s)
for i in range(26):
	now = chr(a + i)
	if k <= c[now]:
		break
	k -= c[now]
ind = i
res = []
cnt = k
for (i, x) in enumerate(s):
	if ord(x) > a + ind:
		res.append(x)
	elif ord(x) == a + ind:
		if cnt == 0:
			res.append(x)
		else:
			cnt -= 1
print(''.join(res))


from collections import Counter
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys
from collections import Counter
(n, k) = map(int, input().split())
s = list(input())
ls = []
ss = sorted(s)
ss = ss[:k]
c = Counter(ss)
ans = ''
for i in range(n):
	if s[i] in c:
		if c[s[i]] > 0:
			c[s[i]] -= 1
		else:
			print(s[i], end='')
	else:
		print(s[i], end='')
print(ans)


(_, k) = map(int, input().split())
s = input()
e = sorted(sorted([(i, e) for (e, i) in enumerate(s)])[k:], key=lambda x: x[1])
print(*map(lambda x: x[0], e), sep='')


(n, k) = [int(x) for x in input().split()]
a = input()
a = list(a)
b = a.copy()
b.sort()
lastAlpha = b[k - 1]
for i in range(n):
	if b[i] == lastAlpha:
		startIndex = i
		break
countLastAlpha = k - startIndex
c = []
for ele in a:
	if ord(ele) > ord(lastAlpha):
		c.append(ele)
	elif ord(ele) == ord(lastAlpha):
		if countLastAlpha != 0:
			countLastAlpha -= 1
			continue
		else:
			c.append(ele)
	else:
		continue
cStr = ''
for ele in c:
	cStr += ele
print(cStr)


l = input().split()
n = int(l[0])
k = int(l[1])
s = input()
freq = [0 for i in range(26)]
for i in s:
	freq[ord(i) - 97] += 1
for i in range(26):
	if freq[i] < k:
		k -= freq[i]
		freq[i] = 0
	else:
		freq[i] -= k
		break
l = []
for i in range(n - 1, -1, -1):
	i = s[i]
	if freq[ord(i) - 97]:
		l.append(i)
		freq[ord(i) - 97] -= 1
l.reverse()
for i in l:
	print(i, end='')
print()


def count(s, p):
	k = 0
	for x in s:
		if x == p:
			k += 1
	return k
(n, k) = map(int, input().split())
s = input()
v = ord('a')
while k > 0:
	if chr(v) in s:
		c = count(s, chr(v))
		if c > k:
			s = s.replace(chr(v), '', k)
			break
		else:
			k -= c
			s = s.replace(chr(v), '', c)
	elif v + 1 <= ord('z'):
		v += 1
	else:
		break
print(s)


from string import ascii_lowercase
a = ascii_lowercase
(n, k) = [int(i) for i in input().split()]
s = input()
i = 0
j = 0
while k != 0:
	z = s.count(a[j])
	s = s.replace(a[j], '', k)
	if k < z:
		break
	else:
		k -= z
	i += 1
	j += 1
print(s)


(n, k) = map(int, input().split())
s = input()
s = list(s)
s1 = s[:]
if k >= n:
	ok = 1
else:
	de = []
	for i in range(0, n):
		x = (s[i], i)
		de.append(x)
	de.sort()
	ans = ''
	for i in range(0, k):
		s[de[i][1]] = ''
	print(''.join(s))


(N, Need) = list(map(int, input().split()))
s = input()
A = dict()
for i in range(97, 123):
	A[chr(i)] = 0
for i in A:
	A[i] = s.count(i)
LOL = 0
KEK = 0
while Need != 0:
	for i in sorted(A.keys()):
		if A[i] > 0:
			if A[i] >= Need:
				A[i] -= Need
				LOL = Need
				KEK = i
				Need = 0
			else:
				Need -= A[i]
				A[i] = 0
			break
for i in range(len(s)):
	if s[i] == KEK:
		if LOL == 0:
			if A[s[i]] > 0:
				print(s[i], end='')
				A[s[i]] -= 1
		else:
			LOL -= 1
	elif A[s[i]] > 0:
		print(s[i], end='')
		A[s[i]] -= 1


(n, k) = map(int, input().split())
lir = input()
lir = '0' + lir
alpha = [0] * 26
resalt = ''
for i in range(1, n + 1):
	alpha[ord(lir[i]) - 97] += 1
for i in range(26):
	if k >= alpha[i]:
		k -= alpha[i]
		alpha[i] = 0
	else:
		alpha[i] -= k
		k = 0
for i in range(n, 0, -1):
	if alpha[ord(lir[i]) - 97] > 0:
		alpha[ord(lir[i]) - 97] -= 1
		resalt += lir[i]
resalt = '0' + resalt
resalt2 = resalt[len(resalt) - 1:0:-1]
print(resalt2)


k = int(input().split()[1])
s = input()
cpt = 0
curChar = 'a'
while cpt < k and len(s) != 0:
	if s.count(curChar) <= k - cpt:
		cpt += s.count(curChar)
		s = s.replace(str(curChar), '')
	else:
		last = -1
		for i in range(len(s)):
			if s[i] == curChar and cpt < k:
				last = i
				cpt += 1
		s = s[:last + 1].replace(str(curChar), '') + s[last + 1:]
	curChar = chr(ord(curChar) + 1)
print(s)


from collections import Counter
(N, K) = map(int, input().split())
S = input()
C = Counter(S)
cnt = 0
for i in range(26):
	c = chr(97 + i)
	if cnt + C[c] >= K:
		break
	else:
		cnt += C[c]
		S = S.replace(c, '')
t = ''
for s in S:
	if s == c and cnt < K:
		cnt += 1
	else:
		t += s
else:
	S = t
print(S)


(n, k) = list(map(int, input().split()))
s = input()
alph = [chr(ord('a') + i) for i in range(26)]
for a in alph:
	if k == 0:
		break
	if s.count(a) <= k:
		k -= s.count(a)
		s = s.replace(a, '')
	else:
		s = s.replace(a, '', k)
		k = 0
print(s)


import string

def main():
	(n, k) = map(int, input().split())
	tab = input()
	occ = {x: [] for x in string.ascii_lowercase}
	for x in range(n):
		occ[tab[x]].append(x)
	for key in occ:
		occ[key] = occ[key][::-1]
	seen = [0] * (n + 1)
	cur = 'a'
	for x in range(k):
		while ord(cur) <= ord('z') and len(occ[cur]) == 0:
			cur = chr(ord(cur) + 1)
		if ord(cur) > ord('z'):
			break
		seen[occ[cur].pop(-1)] = 1
	for x in range(n):
		if not seen[x]:
			print(tab[x], end='')
	print()
main()


import sys
(n, k) = map(int, sys.stdin.readline().split())
s = input()
s1 = s
s1 = sorted(s)
s2 = s1[:k]
j = s1[len(s2) - 1]
s1 = s1[k:]
cj = s2.count(j)
st = ''
J = ord(j)
for i in s:
	if ord(i) < J and k > 0:
		k -= 1
		continue
	if ord(i) == J and cj > 0 and (k > 0):
		k -= 1
		cj -= 1
		continue
	else:
		st += i
print(st)


from string import *
(n, k) = map(int, input().split())
d = {}
for ch in ascii_lowercase:
	d[ch] = []
s = input()
for i in range(len(s)):
	d[s[i]].append(i)
(cnt, rmv) = (0, [0] * k)
_ascii = ord('a')
while _ascii <= ord('z'):
	ch = chr(_ascii)
	for i in d[ch]:
		if cnt == k:
			break
		rmv[cnt] = i
		cnt += 1
	_ascii += 1
lst = n * [0]
for el in rmv:
	lst[el] = 1
for i in range(len(s)):
	if lst[i] == 0:
		print(s[i], end='')


(n, m) = map(int, input().split())
s = input()
az = []
gao = []
for i in range(26):
	az.append(0)
	gao.append(0)
mp = {}
AZ = 'abcdefghijklmnopqrstuvwxyz'
for i in range(26):
	mp[AZ[i]] = i
for i in s:
	az[mp[i]] = az[mp[i]] + 1
for i in range(26):
	if m >= az[i]:
		gao[i] = az[i]
		m -= az[i]
	elif m != 0:
		gao[i] = m
		m = 0
for i in s:
	if gao[mp[i]] > 0:
		gao[mp[i]] = gao[mp[i]] - 1
	else:
		print(i, end='')
print()


s = input()
l = s.split(' ')
(n, k) = (int(l[0]), int(l[1]))
st = zip(input(), range(n))
st_ = sorted(st)
st_ = st_[k:]
n_st = sorted(st_, key=lambda x: x[1])
print(''.join((x[0] for x in n_st)))


(n, k) = map(int, input().split())
s = input()
b = {}
a = {}
g = ''
for i in s:
	if i not in b.keys():
		b[i] = 1
	else:
		b[i] += 1
for i in sorted(b.keys()):
	a[i] = b[i]
for i in a:
	x = a[i]
	a[i] = a[i] - k
	if a[i] <= 0:
		a[i] = 0
	k -= x
	if k <= 0:
		k = 0
		break
for i in s[::-1]:
	if a[i] >= 1:
		g += i
		a[i] -= 1
print(g[::-1])


def main():
	(n, k) = map(int, input().split())
	if n == k:
		return
	s = list(input())
	a = [None] * 26
	for i in range(26):
		a[i] = []
	for i in range(n):
		a[ord(s[i]) - 97].append(i)
	for i in range(26):
		for j in range(len(a[i])):
			s[a[i][j]] = ''
			k -= 1
			if k == 0:
				print(''.join(s))
				return
main()


(n, k) = map(int, input().split())
s = input()
f = [[] for i in range(n)]
a = [n for i in range(26)]
u = [False for i in range(n)]
for i in reversed(range(0, n)):
	f[i] = list(a)
	a[ord(s[i]) - ord('a')] = i
(zm, w) = (0, a[0])
for _ in range(k):
	if _ > 0:
		w = f[w][zm]
	while w == n:
		zm += 1
		w = a[zm]
	u[w] = True
for i in range(n):
	if u[i] == False:
		print(s[i], sep='', end='')


import string
(n, k) = map(int, input().split())
s = str(input())
alpha = string.ascii_lowercase
i = 0
while k != 0:
	if s.count(alpha[i]) != 0:
		if s.count(alpha[i]) >= k:
			s = s.replace(alpha[i], '', k)
			k = 0
		else:
			k -= s.count(alpha[i])
			s = s.replace(alpha[i], '')
	elif len(s) == 0:
		break
	else:
		i += 1
print(s)


(n, k) = map(int, input().split())
s = input()

def main(s, n, k):
	alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	arr = [1 for i in range(n)]
	if n == k:
		print('')
		return
	x = 0
	for i in alphabets:
		j = 0
		while j < n and x < k:
			if i == s[j]:
				arr[j] = 0
				j += 1
				x += 1
			else:
				j += 1
		if x == k:
			break
	for i in range(n):
		if arr[i] == 1:
			print(s[i], end='')
main(s, n, k)


import string
(n, k) = map(int, input().split())
s = list(input())
li = sorted([(c, idx) for (idx, c) in enumerate(s)])
for i in range(k):
	s[li[i][1]] = ''
print(''.join(s))


import math
from collections import defaultdict
getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int, input().split()))
(n, k) = getInputIntList()
s = list(input())
arr = s[:]
s.sort()
cs = s[k:]
myset = {}
myset = defaultdict(lambda : 0, myset)
for i in cs:
	myset[i] += 1
ans = ''
for i in range(len(arr) - 1, -1, -1):
	if arr[i] in myset and myset[arr[i]] > 0:
		ans += arr[i]
		myset[arr[i]] -= 1
print(ans[::-1])


(n, k) = map(int, input().split())
s = input()
a = []
for i in range(n):
	a.append([s[i], i])
a.sort()
b = [a[i][1] for i in range(k)]
b.sort()
b.append(n)
j = 0
for i in range(n):
	if b[j] == i:
		j += 1
	else:
		print(s[i], end='')


(n, k) = input().split()
n = int(n)
k = int(k)
s = input()
alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
i = 0
al = alphabets[i]
while k > 0:
	z = s.count(al)
	s = s.replace(al, '', min(z, k))
	if k <= z:
		break
	k -= z
	i += 1
	al = alphabets[i]
print(s)


from collections import Counter, defaultdict
from string import ascii_lowercase as al
(n, k) = map(int, input().split())
s = list(input())
C = defaultdict(int, Counter(s))
C_ = defaultdict(int)
k_ = k
for char in al:
	temp = min(C[char], k_)
	C_[char] += temp
	k_ -= temp
for (i, el) in enumerate(s):
	if C_[el] > 0:
		s[i] = ''
		C_[el] -= 1
print(''.join(s))


import sys
(a, b) = input().split()
str_input = input()
a = int(a)
b = int(b)
alpha = list('abcdefghijklmnopqrstuvwxyz')
num = 0
while b > 0:
	if alpha[0] in str_input:
		str_output = list(str_input)
		num = str_output.count(alpha[0])
		if num < b:
			str_input = str_input.replace(alpha[0], '')
		else:
			str_input = str_input.replace(alpha[0], '', b)
		b -= num
	else:
		del alpha[0]
print(str_input)


from collections import Counter
import string

def main():
	(n, k) = map(int, input().split())
	s = input()
	(a, t) = ({x: [] for x in string.ascii_lowercase}, [])
	for (i, x) in enumerate(s):
		a[x].append(i)
	for (c, l) in a.items():
		skip = min(k, len(l))
		k -= skip
		for i in range(skip, len(l)):
			t.append((l[i], c))
	print(''.join((x[1] for x in sorted(t))))
main()


from collections import Counter
(n, k) = map(int, input().split())
s = input()
c = Counter(s)
for i in range(97, 123):
	if c[chr(i)] <= k:
		k -= c[chr(i)]
	else:
		break
	if k == 0:
		break
for j in range(97, i):
	s = s.replace(chr(j), '')
	j += 1
if k == 0:
	s = s.replace(chr(i), '')
else:
	s = s.replace(chr(i), '', k)
print(s)


(a, b) = map(int, input().split())
stri = list(input())
ind = sorted(((v, i) for (i, v) in enumerate(stri)))
for x in range(b):
	stri[ind[x][1]] = ''
print(''.join(stri))


(size, qtd) = map(int, input().split())
frase = input()
quantidade = {}
for letra in frase:
	if letra not in quantidade:
		quantidade[letra] = 0
	quantidade[letra] += 1
remover = {}
letra = 'a'
for _ in range(qtd):
	while letra not in quantidade or quantidade[letra] == 0:
		letra = chr(ord(letra) + 1)
	if letra not in remover:
		remover[letra] = 0
	remover[letra] += 1
	quantidade[letra] -= 1
frase_final = list()
for letra in frase:
	if letra not in remover or remover[letra] == 0:
		frase_final.append(letra)
	else:
		remover[letra] -= 1
print(''.join(frase_final))


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	(n, k) = li()
	a = input().strip()
	a = list(a)
	ans = []
	for i in range(n):
		ans.append([a[i], i])
	ans.sort()
	for i in range(k):
		a[ans[i][1]] = ''
	print(''.join(map(str, a)))
for _ in range(1):
	case()


(n, k) = map(int, input().split())
s = input()
d = {}
for i in range(n):
	if not d.get(s[i]):
		d[s[i]] = [i]
	else:
		d[s[i]].append(i)
a = [True] * n
flag = 0
for x in sorted(d.keys()):
	for i in range(0, len(d[x])):
		if k > 0:
			a[d[x][i]] = False
			k -= 1
		else:
			falg = 1
			break
	if flag:
		break
for i in range(n):
	if a[i]:
		print(s[i], end='')


digl = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
mod = 10 ** 9 + 7
(n, k) = f()
s = sorted(enumerate(ls()), key=lambda x: x[1])
so = sorted(s[k:], key=lambda x: x[0])
[print(i, end='') for (j, i) in so]


(n, k) = [int(x) for x in input().split()]
s = [i for i in input()]
P = {}
V = {}
for i in range(n):
	if s[i] in P:
		P[s[i]].append(i)
		V[s[i]] += 1
	else:
		P[s[i]] = [i]
		V[s[i]] = 1
t = sorted(s)
for i in range(k):
	V[t[i]] -= 1
W = [0] * n
for i in V:
	j = V[i]
	for j in range(-1, -V[i] - 1, -1):
		W[P[i][j]] = i
ans = ''
for t in W:
	if t != 0:
		ans = ans + t
print(ans)


from sys import stdin, stdout
(n, k) = [int(x) for x in stdin.readline().split()]
s = stdin.readline().strip()
ans = list()
alpha = dict()
for d in s:
	alpha[d] = list()
	ans.append('')
for i in range(n):
	alpha[s[i]].append(i)
chk = False
my_keys = sorted(alpha.keys())
for key in my_keys:
	if chk:
		for i in range(0, len(alpha[key])):
			ans[alpha[key][i]] = key
		continue
	if k - len(alpha[key]) <= 0:
		for i in range(k, len(alpha[key])):
			ans[alpha[key][i]] = key
		chk = True
	else:
		k -= len(alpha[key])
print(''.join(ans))


import time

def f(i):
	return ord(i) - ord('a')
(n, k) = (int(i) for i in input().split())
t = list(input())
start = time.time()
b = [0 for i in range(ord('a'), ord('z') + 1)]
for i in t:
	b[f(i)] += 1
for i in range(len(b)):
	if b[i] <= k:
		k -= b[i]
	else:
		b[i] = k
		k = 0
ans = ''
for i in t:
	if b[f(i)] == 0:
		ans += i
	else:
		b[f(i)] -= 1
print(ans)
finish = time.time()


(n, k) = map(int, input().split())
s = input()
alpha = 'a'
dic = {}
l = []
res = []
for i in range(0, 26):
	dic[alpha] = 0
	l.append(alpha)
	alpha = chr(ord(alpha) + 1)
for i in s:
	dic[i] = dic[i] + 1
i = 0
while k > 0:
	x = k
	k = k - dic[l[i]]
	dic[l[i]] = dic[l[i]] - x
	if dic[l[i]] < 0:
		dic[l[i]] = 0
	i = i + 1
for i in range(n - 1, -1, -1):
	if dic[s[i]] > 0:
		res.append(s[i])
		dic[s[i]] = dic[s[i]] - 1
res.reverse()
print(''.join(res))


(n, k) = map(int, input().split())
s = str(input())
lst = list(set(list(s)))
lst.sort()
for i in range(len(lst)):
	p = s.count(lst[i])
	if k == 0:
		break
	if p <= k:
		s = s.replace(lst[i], '', p)
		k -= p
	elif p > k:
		s = s.replace(lst[i], '', k)
		k = 0
print(s)


from collections import Counter
(n, k) = [int(x) for x in input().split()]
s = input()
t = []
for i in range(len(s)):
	t.append([i, s[i]])
t.sort(key=lambda x: x[1])
t = t[k:]
t.sort()
ans = ''
for j in t:
	ans += j[1]
print(ans)


import collections
from functools import cmp_to_key
import math
import sys

def getIntList():
	return list(map(int, input().split()))
import bisect
try:
	import numpy
	dprint = print
	dprint('debug mode')
except ModuleNotFoundError:

	def dprint(*args, **kwargs):
		pass

def makePair(z):
	return [(z[i], z[i + 1]) for i in range(0, len(z), 2)]
(N, K) = getIntList()
s = input()
s = list(s)
c = collections.Counter()
c1 = collections.Counter()
for x in s:
	c[ord(x)] += 1
for i in range(ord('a'), ord('z') + 1):
	if K > c[i]:
		c1[i] = c[i]
		K -= c[i]
	else:
		c1[i] = K
		K = 0
dprint(c1)
for i in range(N):
	t = ord(s[i])
	if c1[t] > 0:
		s[i] = ''
		c1[t] -= 1
dprint(c1)
print(''.join(s))


(n, k) = map(int, input().split())
s = input()
d = dict()
for c in s:
	d[c] = d.setdefault(c, 0) + 1
r = n - k
stop_c = 'a'
for c in reversed(sorted(d.keys())):
	if d[c] <= r:
		r -= d[c]
	else:
		stop_c = c
		break
res = []
for c in reversed(s):
	if c > stop_c:
		res.append(c)
	elif c == stop_c:
		if r > 0:
			res.append(c)
			r -= 1
print(''.join(reversed(res)))


from itertools import accumulate
(n, k) = list(map(int, input().split()))
word = input()
lis = sorted(list(set(word)))
t = []
if n == k:
	print('')
else:
	for item in lis:
		if word.count(item) != 0:
			t.append(word.count(item))
	t = list(accumulate(t))
	if k in t:
		if len(set(word)) != 1:
			print(''.join([item for item in word if item not in lis[:t.index(k) + 1]]))
		else:
			print(word[0])
	elif k not in t:
		res = [item for item in t if item < k]
		if len(res) == 0:
			fin = word.replace(lis[0], '', k)
			print(fin)
		else:
			maxa = max(res)
			fin = ''.join([item for item in word if item not in lis[:t.index(maxa) + 1]])
			print(fin.replace(lis[t.index(maxa) + 1], '', k - maxa))


(n, k) = map(int, input().split())
s = str(input())
arr = []
dict1 = {}
for i in range(n):
	arr.append(s[i])
	try:
		dict1[arr[i]] += 1
	except:
		KeyError
		dict1[arr[i]] = 1
s1 = 'abcdefghijklmnopqrstuvwxyz'
z = 0
arr2 = []
y = ''
for i in range(26):
	try:
		if dict1[s1[i]] + z <= k:
			arr2.append(s1[i])
			z += dict1[s1[i]]
		else:
			y = s1[i]
			break
	except:
		KeyError
i = 0
j = 0
while i < len(s):
	if arr[i] == y and z + j < k:
		arr[i] = ''
		j += 1
	elif arr[i] in arr2:
		arr[i] = ''
		i += 1
	else:
		i += 1
print(''.join((str(i) for i in arr)))


import sys
input = sys.stdin.readline
out = sys.stdout
(k, n) = map(int, input().split())
s = input()
if k == n:
	print('')
else:
	d = {chr(i + 97): 0 for i in range(27)}
	for i in range(k):
		d[s[i]] += 1
	cur = ''
	for k in d.keys():
		if n >= d[k]:
			n -= d[k]
		else:
			cur = k
			break
	for i in s:
		if i < cur:
			continue
		elif i == cur:
			if n == 0:
				out.write(i)
			else:
				n -= 1
		else:
			out.write(i)


(n, k) = map(int, input().split())
e = input()
if n != k:
	x = []
	for (i, y) in enumerate(e):
		x.append(y)
	from collections import Counter
	c = Counter(x)
	s = 'abcdefghijklmnopqrstuvwxyz'
	for i in range(26):
		a = s[i]
		if k < c[a]:
			v = a
			break
		else:
			k -= c[a]
	rez = ''
	for (i, y) in enumerate(e):
		if y > v:
			rez += y
		if y == v:
			if k > 0:
				k -= 1
			else:
				rez += y
	print(rez)


(n, k) = map(int, input().split())
l = list(input())
ind = [[] for i in range(26)]
for i in range(n):
	ind[ord(l[i]) - 97].append(i)
flat = [item for sublist in ind for item in sublist]
for i in range(k):
	l[flat[i]] = ''
print(*l, sep='')


(n, k) = map(int, input().split())
s = input()
for i in range(97, 123):
	if k < 1:
		break
	a = chr(i)
	c = s.count(a)
	s = s.replace(a, '', min(c, k))
	k = k - min(c, k)
print(s)


(n, k) = map(int, input().split())
s = input()
d = dict()
if n == k:
	print('')
else:
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	d2 = dict()
	char = min(list(d.keys()))
	while k != 0:
		if char in d:
			if d[char] >= k:
				d2[char] = k
				break
			else:
				d2[char] = d[char]
				k -= d[char]
				del d[char]
				char = min(list(d.keys()))
	for i in s:
		if i not in d2:
			print(i, end='')
		elif d2[i] == 0:
			print(i, end='')
		else:
			d2[i] -= 1
	print()


from collections import Counter, defaultdict
BS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def to_base(s, b):
	res = ''
	while s:
		res += BS[s % b]
		s //= b
	return res[::-1] or '0'
alpha = 'abcdefghijklmnopqrstuvwxyz'
from math import floor, ceil, pi
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919]

def primef(n, plst=[]):
	if n == 1:
		return plst
	else:
		for m in primes:
			if n % m == 0:
				return primef(n // m, plst + [m])
		return primef(1, plst + [n])

def scoreBad(s):
	res = 0
	counter = 0
	while True:
		cur = int(counter)
		ok = True
		for i in range(len(s)):
			res += 1
			if s[i] == '+':
				cur += 1
			else:
				cur -= 1
			if cur < 0:
				ok = False
				break
		counter += 1
		if ok:
			break
	return res

def lmii():
	return list(map(int, input().split()))

def ii():
	return int(input())

def factors(n):
	got = []
	for i in range(1, n + 1):
		if n % i == 0:
			got.append(i)
	return got
conv = {chr(i + 97): i for i in range(26)}
(n, k) = lmii()
s = list(input())
comp = [(i, ind) for (ind, i) in enumerate(s)]
comp.sort()
comp = comp[k:]
ans = [''] * n
for (i, j) in comp:
	ans[j] = i
print(''.join(ans))


from collections import defaultdict
from collections import deque
abc = 'abcdefghijklmnopqrstuvwxyz'
(n, k) = input().split()
n = int(n)
k = int(k)
s = input()
d = defaultdict(list)
for (i, c) in enumerate(s):
	d[c].append(i)
for c in abc:
	if len(d[c]) < k:
		k -= len(d[c])
		d[c] = []
	else:
		del d[c][:k]
		break
out = [''] * n
for (c, l) in d.items():
	for i in l:
		out[i] = c
print(''.join(out))


(n, k) = map(int, input().split())
s = input()
counts = {}
for el in s:
	counts[el] = counts.get(el, 0) + 1
for key in 'abcdefghijklmnopqrstuvwxyz':
	if key in counts:
		sub = min(k, counts[key])
		counts[key] -= sub
		k -= sub
		if not k:
			break
ans = [''] * (n - k)
end = n - k - 1
for i in range(n - 1, -1, -1):
	if counts[s[i]]:
		ans[end] = s[i]
		counts[s[i]] -= 1
		end -= 1
print(''.join(ans))


(n, k) = map(int, input().split())
s = input().rstrip()
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
kdup = k
kset = []
for i in alphabet:
	if s.count(i) > kdup:
		for t in range(kdup):
			kset.append(i)
		kdup = 0
	elif s.count(i) <= kdup:
		for t in range(s.count(i)):
			kset.append(i)
		kdup -= s.count(i)
lts = {}
for i in range(26):
	lts[alphabet[i]] = 0
for i in range(k):
	lts[kset[i]] += 1
newstr = []
for i in range(n):
	if lts[s[i]] <= 0:
		newstr.append(s[i])
	else:
		lts[s[i]] -= 1
print(''.join(newstr))


(n, k) = map(int, input().split())
s = list(input())
a = sorted([[x, i] for (i, x) in enumerate(s)])
for i in range(k):
	s[a[i][1]] = ''
print(''.join(s))


(n, k) = map(int, input().split())
s = input()
d = [0] * 27
for x in s:
	d[ord(x) - 97] += 1
(sum, pos) = (0, -1)
for i in range(27):
	if sum + d[i] <= k:
		pos = i
		sum += d[i]
	else:
		break
k -= sum
b = [x for x in s if ord(x) - 97 > pos]
pos += 1
c = []
for x in b:
	if x != chr(pos + 97):
		c.append(x)
	if x == chr(pos + 97):
		if k == 0:
			c.append(x)
		else:
			k -= 1
print(''.join(c))


(n, k) = list(map(int, input().split()))
alphas = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
string = list(input())
ans = ['' for i in range(len(string))]
dic = {letter: [] for letter in alphas}
for i in range(len(string)):
	dic[string[i]] += [i]
i = 0
current = 0
while i < k:
	c = string.count(alphas[current])
	if i + c <= k:
		dic[alphas[current]] = []
		i = i + c
		current += 1
	else:
		dic[alphas[current]] = dic[alphas[current]][-(i + c - k):]
		i = k
for letter in alphas:
	for num in dic[letter]:
		ans[num] = letter
print(''.join(ans))


(n, k) = map(int, input().split())
if k != n:
	s = input()
	d = {}
	for x in s:
		if not x in d:
			d[x] = 0
		d[x] += 1
	lst = sorted(d.keys())
	x = 0
	while x < len(lst):
		if d[lst[x]] > k:
			i = k
			b = lst[x]
			break
		else:
			k -= d[lst[x]]
			x += 1
	acc = 0
	for x in s:
		if x == b:
			acc += 1
			if acc > k:
				print(x, end='')
		elif x > b:
			print(x, end='')


(n, k) = map(int, input().split())
s = [*input()]
from collections import *
cnt = Counter(s)
for c in 'abcdefghijklmnopqrstuvwxyz':
	if cnt[c] < k:
		k -= cnt[c]
	else:
		break
res = 0
t = []
for a in s:
	if a < c:
		pass
	elif k and a == c:
		k -= 1
	else:
		t.append(a)
print(''.join(t))


(a, b) = map(int, input().split())
string = input()
letter = 97
while b > 0:
	counter = string.count(chr(letter))
	string = string.replace(chr(letter), '', min(counter, b))
	if b <= counter:
		break
	b -= counter
	letter += 1
print(string)


from string import ascii_lowercase
(n, k) = map(int, input().split())
s = input()
for i in range(26):
	c = s.count(ascii_lowercase[i])
	s = s.replace(ascii_lowercase[i], '', min(c, k))
	k -= c
	if k < 1:
		break
print(s)


from collections import deque, defaultdict

def f(s, k):
	d = defaultdict(deque)
	for (i, c) in enumerate(s):
		d[c].append(i)
	removed = set()
	for i in range(k):
		for ss in 'abcdefghijklmnopqrstuvwxyz':
			if ss in d and d[ss]:
				idx = d[ss].popleft()
				removed.add(idx)
				break
	res = []
	for (i, c) in enumerate(s):
		if i not in removed:
			res.append(c)
	return ''.join(res)
(n, k) = [int(i) for i in input().split()]
s = input()
print(f(s, k))


(n, k) = [int(c) for c in input().split(' ')]
line = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'
occurences = {}
for alpha in alphabet:
	occurences[alpha] = 0
for ch in line:
	occurences[ch] += 1
for alpha in alphabet:
	if occurences[alpha] <= k:
		k -= occurences[alpha]
		occurences[alpha] = 0
	else:
		occurences[alpha] -= k
		k = 0
		break
mark = [False for i in range(len(line))]
for i in range(len(line) - 1, -1, -1):
	ch = line[i]
	if occurences[ch] > 0:
		mark[i] = True
		occurences[ch] -= 1
for i in range(len(line)):
	if mark[i]:
		print(line[i], end='')


tmp = input().split()
n = int(tmp[0])
k = int(tmp[1])
s = input()
arr = []
for i in s:
	arr.append(i)
num = [0 for i in range(30)]
for i in arr:
	num[ord(i) - 97] += 1
num2 = []
for i in num:
	num2.append(i)
for i in range(26):
	if k <= num[i]:
		num[i] -= k
		break
	else:
		k -= num[i]
		num[i] = 0
for i in range(n):
	if num2[ord(arr[i]) - 97] > num[ord(arr[i]) - 97]:
		num[ord(arr[i]) - 97] += 1
		arr[i] = 0
for i in range(n):
	if arr[i] != 0:
		print(arr[i], end='')


from collections import Counter

def main():
	(n, k) = map(int, input().split())
	s = input()
	counts = Counter(s)
	sorted_keys = sorted(counts.keys())
	key_c = '$'
	for key in sorted_keys:
		val = counts[key]
		if val < k:
			k -= val
		else:
			key_c = key
			break
	res = []
	del_kc = True
	for c in s:
		if del_kc and c == key_c:
			if k == 1:
				del_kc = False
			else:
				k -= 1
		elif c >= key_c:
			res.append(c)
	print(''.join(res))
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
s = input()
from collections import defaultdict
l1 = [1] * n
d = defaultdict(list)
l = []
for i in range(n):
	d[s[i]].append(i)
for i in range(97, 123):
	for j in range(len(d[chr(i)])):
		l1[d[chr(i)][j]] = 0
		k -= 1
		if k == 0:
			break
	if k == 0:
		break
ans = []
for i in range(n):
	if l1[i]:
		ans.append(s[i])
print(''.join(ans))


(n, k) = map(int, input().split())
s = input()
cnt = [0 for i in range(26)]
for i in s:
	cnt[ord(i) - ord('a')] += 1
total = 0
cnt2 = [0 for i in range(26)]
for i in range(26):
	if total + cnt[i] <= k:
		cnt2[i] = cnt[i]
		total += cnt[i]
	else:
		cnt2[i] = k - total
		break
cnt3 = [0 for i in range(26)]
ans = ''
for i in s:
	c = ord(i) - ord('a')
	if cnt3[c] < cnt2[c]:
		cnt3[c] += 1
	else:
		ans += i
print(ans)


(n, k) = [int(s) for s in input().split(' ')]
string = input()
letter = 'a'
while k > 0:
	if letter in string:
		numbOfOccur = string.count(letter)
		if numbOfOccur >= k:
			string = string.replace(letter, '', k)
			break
		else:
			string = string.replace(letter, '')
			k -= numbOfOccur
	letter = chr(ord(letter) + 1)
print(string)


from collections import *
dd = defaultdict(lambda : 0)
(n, k) = map(int, input().split())
s = input()
for ch in s:
	dd[ch] += 1
D = dd.copy()
letter = []
for i in range(26):
	letter.append('%c' % (97 + i))
for ch in letter:
	if dd[ch] <= k:
		k -= dd[ch]
		dd[ch] = 0
	else:
		dd[ch] -= k
		k = 0
	if k == 0:
		break
cntD = defaultdict(lambda : 0)
flag = False
for ch in s:
	if cntD[ch] < D[ch] - dd[ch]:
		cntD[ch] += 1
	else:
		print(ch, end='')
		flag = True
if flag:
	print('')


from collections import Counter
(n, k) = map(int, input().split())
word = input()
keys = sorted(list(set(list(word))))
freq = Counter(word)
complete = set()
partial = []
for i in keys:
	k -= freq[i]
	if k >= 0:
		complete.add(i)
	else:
		partial.append(i)
		k += freq[i]
		break
ans = []
for i in word:
	if i not in complete:
		if i in partial:
			if k > 0:
				k -= 1
			else:
				ans.append(i)
		else:
			ans.append(i)
print(''.join(ans))


(n, k) = map(int, input().split())
s = input()
s = sorted([(i, j) for (i, j) in enumerate(s)], key=lambda x: x[1])
s = ''.join((x[1] for x in sorted(s[k:], key=lambda x: x[0])))
print(s)


(n, k) = map(int, input().split())
s = input()
abc = 'abcdefghijklmnopqrstuvwxyz'
dic = {}
for x in abc:
	dic[x] = 0
for x in s:
	dic[x] += 1
su = 0
res = chr(ord('z') + 1)
for x in abc:
	if su + dic[x] > k:
		res = x
		f = dic[x] - (su + dic[x] - k)
		break
	else:
		su += dic[x]
ss = []
for x in s:
	if x == res:
		if f == 0:
			ss.append(x)
		else:
			f -= 1
	if x > res:
		ss.append(x)
if len(ss) > 0:
	print(''.join(ss))


def solve(string, k):
	indexes = {}
	banned = [False] * len(string)
	abc = 'abcdefghijklmnopqrstuvwxyz'
	abc_index = 0
	for i in reversed(range(len(string))):
		char = string[i]
		if char not in indexes:
			indexes[char] = [i]
		else:
			indexes[char].append(i)
	for j in range(k):
		char = abc[abc_index]
		while char not in indexes:
			abc_index += 1
			char = abc[abc_index]
		banned_index = indexes[char].pop()
		banned[banned_index] = True
		if len(indexes[char]) == 0:
			del indexes[char]
	new_string = ''
	for i in range(len(string)):
		if not banned[i]:
			new_string += string[i]
	return new_string
(n, k) = map(int, input().split())
string = input().rstrip('\r\n')
solution = solve(string, k)
print(solution)


(n, k) = [int(x) for x in input().strip().split(' ')]
s = input()
m = {}
for c in s:
	if c not in m:
		m[c] = 0
	m[c] += 1
to_remove = {}
remains = k
c = 'a'
while remains > 0:
	if c in m:
		to_remove[c] = min(m[c], remains)
		remains -= m[c]
	c = chr(ord(c) + 1)
r = ''
for c in s:
	if c in to_remove and to_remove[c] > 0:
		to_remove[c] -= 1
	else:
		r += c
print(r)


(n, k) = map(int, input().split())
a = list(input())
c = [0] * 26
m = k
for i in range(n):
	c[ord(a[i]) - ord('a')] += 1
d = c[:]
for j in range(26):
	if m >= c[j]:
		m -= c[j]
		c[j] = 0
	else:
		c[j] -= m
		m = 0
	if m == 0:
		break
e = []
for i in a:
	if c[ord(i) - ord('a')] < d[ord(i) - ord('a')]:
		d[ord(i) - ord('a')] -= 1
	else:
		e.append(i)
print(''.join(e))


R = lambda : map(int, input().split())
(n, k) = list(R())
s = input()
x = sorted(s)
c = {}
for i in range(k):
	if x[i] not in c:
		c[x[i]] = 1
	else:
		c[x[i]] += 1
result = ''
for j in range(n):
	if s[j] not in c or c[s[j]] == 0:
		result += s[j]
	else:
		c[s[j]] -= 1
print(result)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(n, k) = iia()
s = is1()
if n == k:
	print('')
else:
	d = {}
	for i in s:
		d.setdefault(i, [0])[0] += 1
	rem = {}
	for i in sorted(d):
		if d[i][0] <= k:
			rem[i] = [d[i][0]]
			k -= d[i][0]
		else:
			rem[i] = [k]
			break
	res = ''
	for i in s:
		if i in rem and rem[i][0] > 0:
			rem[i][0] -= 1
		else:
			res += i
	print(res)


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
(n, k) = map(int, input().split())
s = input()
d = [0] * 128
for char in s:
	d[ord(char)] += 1
to_remove = [0] * 128
for char in range(128):
	todo = min(k, d[char])
	k -= todo
	to_remove[char] = todo
out = ''
for char in s:
	q = ord(char)
	if to_remove[q] != 0:
		to_remove[q] -= 1
	else:
		print(char, end='')
print()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def main():
	(n, k) = LI()
	s = S()
	c = collections.Counter(s)
	t = k
	d = 'a'
	for b in string.ascii_lowercase:
		u = c[b]
		if t <= u:
			d = b
			break
		t -= u
	r = []
	for b in s:
		if b < d:
			continue
		if b == d and t > 0:
			t -= 1
		else:
			r.append(b)
	return JA(r, '')
print(main())


(n, k) = (int(x) for x in input().split())
s = input()
alph = 'abcdefghijklmnopqrstuvwxyz'
a = []
for i in range(26):
	if alph[i] in s:
		bukva = alph[i]
		a.append(s.count(bukva))
	else:
		a.append(0)
last_index = -1
ost = k
for i in range(26):
	tmp = ost - a[i]
	if tmp <= 0:
		last_index = i
		a[i] = ost
		break
	else:
		ost = ost - a[i]
alph = alph[:last_index + 1]
for i in range(n):
	if s[i] in alph:
		if a[alph.index(s[i])] > 0:
			a[alph.index(s[i])] -= 1
			print('', end='')
		else:
			print(s[i], end='')
	else:
		print(s[i], end='')


(n, k) = input().split(' ')
n = int(n)
k = int(k)
s = list(input())
coun = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for c in s:
	coun[ord(c) - ord('a')] += 1
st = 0
while st < 26 and k - coun[st] >= 0:
	k -= coun[st]
	st += 1
if st < 26:
	for c in s:
		if ord(c) > ord('a') + st:
			print(c, end='')
		elif ord(c) == ord('a') + st:
			if k <= 0:
				print(c, end='')
			else:
				k -= 1


def solve(n, k, s):
	chars = [0] * 26
	for c in s:
		chars[ord(c) - ord('a')] += 1
	count = 0
	for i in range(26):
		if count + chars[i] >= k:
			chars[i] = max(0, k - count)
		count += chars[i]
	ans = []
	for c in s:
		if chars[ord(c) - ord('a')]:
			chars[ord(c) - ord('a')] -= 1
		else:
			ans.append(c)
	return ''.join(ans)

def main():
	(n, k) = map(int, input().strip().split())
	s = input().strip()
	result = solve(n, k, s)
	print(result)
main()


(n, k) = [int(i) for i in input().split()]
s = list(input())
l = len(s)
d = {}
f = [True] * l
for i in range(l):
	if not s[i] in d:
		d[s[i]] = []
	d[s[i]].append(i)
rule = []
for i in range(26):
	wk1 = chr(i + 97)
	if wk1 in d:
		rule.append(wk1)
current = 0
position = 0
for i in range(k):
	f[d[rule[current]][position]] = False
	position += 1
	if position == len(d[rule[current]]):
		position = 0
		current += 1
	if current == len(rule):
		break
for i in range(l):
	if f[i]:
		print(s[i], end='')
print()


import sys
(n, K) = list(map(int, input().strip().split()))
s = input()
ans = 0
alphabet = 'abcdefghijklmnopqrstuvwxyz'

def goprint(s):
	print(s)
	exit(0)
for i in alphabet:
	s = s.replace(i, '', K)
	K = K - (n - len(s))
	n = len(s)
	if K == 0:
		break
print(s)


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
(N, K) = MAP()
S = [ord(s) - 97 for s in input()]
idxs = [[] for i in range(26)]
for i in range(N):
	idxs[S[i]].append(i)
for c in range(26):
	idxs[c] = idxs[c][::-1]
used = [False] * N
for _ in range(K):
	for c in range(26):
		if idxs[c]:
			i = idxs[c].pop()
			used[i] = True
			break
ans = []
for i in range(N):
	if not used[i]:
		ans.append(chr(S[i] + 97))
print(''.join(ans))


(n, k) = map(int, input().split())
string = input()
hmap = 'abcdefghijklmnopqrstuvwxyz'
scnt = 0
for c in hmap:
	if k < 1:
		break
	scnt = string.count(c)
	string = string.replace(c, '', min(scnt, k))
	k -= scnt
print(string)


c = input().split(' ')
a = int(c[0])
b = int(c[1])
inp = input(str())
count = [0 for i in range(26)]
ind = []
for i in range(a):
	count[ord(inp[i]) - ord('a')] += 1
running = 0
hit = -1
for i in range(26):
	running += count[i]
	if running >= b:
		hit = i
		break
rem = running - b
counter = 0
for i in range(a - 1, -1, -1):
	if ord(inp[i]) - ord('a') > hit:
		ind.append(i)
	elif ord(inp[i]) - ord('a') == hit and counter < rem:
		counter += 1
		ind.append(i)
	else:
		pass
ind = reversed(ind)
ans = ''
for i in ind:
	ans += inp[i]
print(ans)


p = input().rstrip().split(' ')
q = input().rstrip()
x = list(q)
if int(p[1]) >= len(x):
	pass
else:
	l = [0] * 10000000
	B = int(p[1])
	for i in range(0, len(x)):
		l[ord(x[i]) - 97] += 1
	for i in range(0, int(p[1])):
		for j in range(0, len(l)):
			if l[j] > 0:
				l[j] -= 1
				break
	W = []
	for i in range(len(x) - 1, -1, -1):
		if l[ord(x[i]) - 97] > 0:
			l[ord(x[i]) - 97] -= 1
			W.append(x[i])
	W.reverse()
	print(''.join(W))


from string import ascii_lowercase as asc
(a, n) = [int(i) for i in input().split()]
s = list(input())
mas = []
for i in range(len(s)):
	mas.append((s[i], i))
mas.sort()
mas = mas[n:]
mas.sort(key=lambda s: s[1])
for i in range(len(mas)):
	print(mas[i][0], end='')


from bisect import *
(n, k) = map(int, input().split())
s = input()
from collections import *
al = defaultdict(int)
for i in range(len(s)):
	al[s[i]] += 1
ans = [0 for i in range(26)]
for i in range(26):
	ans[i] = al[chr(97 + i)]
for i in range(1, 26):
	ans[i] += ans[i - 1]
m = bisect_left(ans, k)
if m > 0:
	lets = k - ans[m - 1]
else:
	lets = k
temp = []
count = 0
for i in range(len(s)):
	if ord(s[i]) - 97 > m:
		temp.append(s[i])
	elif ord(s[i]) - 97 == m:
		if count < lets:
			count += 1
		else:
			temp.append(s[i])
print(''.join(map(str, temp)))


(n, k) = map(int, input().split())
str = input()
arr = [0 for x in range(26)]
for p in str:
	arr[ord(p) - 97] += 1
for p in range(26):
	if arr[p] > 0 and k != 0:
		if arr[p] < k:
			k -= arr[p]
			arr[p] = 0
		else:
			arr[p] -= k
			k = 0
out = ['' for p in range(n)]
for p in range(n - 1, -1, -1):
	if arr[ord(str[p]) - 97] > 0:
		out[p] = str[p]
		arr[ord(str[p]) - 97] -= 1
print(''.join(out))


z = input
(n, m) = map(int, z().split())
l = z()
for i in range(97, 123):
	l = l.replace(chr(i), '', max(0, len(l) - n + m))
print(l)


from sys import stdin
from math import *
line = stdin.readline().rstrip().split()
n = int(line[0])
k = int(line[1])
s = list(stdin.readline().rstrip())
index = []
for i in range(26):
	index.append([])
for i in range(len(s)):
	cod = ord(s[i]) - ord('a')
	index[cod].append(i)
while k > 0:
	for cod in range(26):
		if k == 0:
			break
		for i in index[cod]:
			if k == 0:
				break
			k -= 1
			s[i] = '.'
s2 = []
for car in s:
	if car != '.':
		s2.append(car)
s = ''.join(s2)
print(s)


(n, k) = map(int, input().split())
s = str(input())
X = [[] for _ in range(26)]
for i in reversed(range(n)):
	c = s[i]
	j = ord(c) - ord('a')
	X[j].append(i)
for i in range(k):
	for j in range(26):
		if X[j]:
			X[j].pop()
			break
t = []
for i in range(26):
	c = chr(i + ord('a'))
	for j in X[i]:
		t.append((j, c))
t.sort()
ans = []
for (j, c) in t:
	ans.append(c)
print(''.join(ans))


(n, k) = map(int, input().split())
s = list(input())
s_p = [['a', 0] for i in range(n)]
for i in range(n):
	s_p[i] = [s[i], i]
s_p.sort()
s_p = s_p[k:]
s_p.sort(key=lambda x: x[1])
for i in s_p:
	print(i[0], end='')
print()


(n, k) = map(int, input().split())
s = input()
asc = 97
while k > 0:
	cnt = s.count(chr(asc))
	if k < cnt:
		s = s.replace(chr(asc), '', k)
		break
	else:
		s = s.replace(chr(asc), '', cnt)
	k -= cnt
	asc += 1
print(s)


import string
ii = input()
n = int(ii.split(' ')[0])
k = int(ii.split(' ')[1])
s = input()
ddd = {}
deleted = {}
for (idx, l) in enumerate(s):
	if l not in ddd:
		ddd[l] = 0
	ddd[l] = ddd[l] + 1
while k:
	for letter in string.ascii_lowercase:
		if letter in ddd:
			if k >= ddd[letter]:
				k = k - ddd[letter]
				deleted[letter] = ddd[letter]
				del ddd[letter]
				break
			else:
				deleted[letter] = k
				k = 0
for i in s:
	if i in deleted and deleted[i] > 0:
		deleted[i] -= 1
		if deleted[i] == 0:
			del deleted[i]
	else:
		print(i, end='')


(n, k) = map(int, input().split())
s = input()
let_ind = {}
ind_let = list(s)
for i in range(len(s)):
	cur_let = let_ind.get(s[i], [])
	cur_let.append(i)
	let_ind[s[i]] = cur_let
miss = set()
for i in range(ord('a'), ord('z') + 1):
	cur_let_s = let_ind.get(chr(i), [])
	if len(cur_let_s) <= k:
		for j in cur_let_s:
			miss.add(j)
		k -= len(cur_let_s)
	else:
		for j in cur_let_s[:k]:
			miss.add(j)
		k = 0
	if not k:
		break
for i in range(n):
	if i not in miss:
		print(ind_let[i], end='')


__author__ = 'Esfandiar and HajLorenzo'
from collections import Counter
a = list(map(int, input().split()))
s = input()
c = Counter(s)
home = []
h = 97
while True:
	if c[chr(h)] < a[1]:
		s = s.replace(chr(h), '', c[chr(h)])
		a[1] -= c[chr(h)]
		h += 1
	else:
		s = s.replace(chr(h), '', a[1])
		break
print(s)


p = input().rstrip().split(' ')
s = input().rstrip()
x = list(s)
L = [0] * 26
L = list(L)
Q = []
W = []
D = []
k = int(p[1])
for i in range(0, len(x)):
	L[ord(x[i]) - 97] += 1
for i in range(0, len(L)):
	if L[i] != 0 and k > 0:
		if L[i] <= k:
			k = k - L[i]
			Q.append(i)
		else:
			W.append(i)
			D.append(k)
			break
for i in range(0, len(x)):
	if ord(x[i]) - 97 in Q:
		continue
	elif ord(x[i]) - 97 in W:
		A = W.index(ord(x[i]) - 97)
		B = D[A]
		if B > 0:
			D[A] -= 1
		else:
			print(x[i], end='')
	else:
		print(x[i], end='')


import collections
import string
(n, k) = (int(x) for x in input().split())
s = input()
indices = collections.defaultdict(list)
for (i, c) in enumerate(s):
	indices[c].append(i)
removed = [False for i in range(len(s))]
for c in string.ascii_lowercase:
	if k == 0:
		break
	for i in indices[c]:
		removed[i] = True
		k -= 1
		if k == 0:
			break
for (c, r) in zip(s, removed):
	if not r:
		print(c, end='')
print()


import string
letters = list(string.ascii_lowercase)
(n, k) = map(int, input().split())
a = list(input())
for i in range(n):
	a[i] = (i, a[i])
a.sort(key=lambda x: x[1])
a = a[k:]
a.sort(key=lambda x: x[0])
for i in range(len(a)):
	print(a[i][1], end='')


import sys
(n, a) = list(map(int, input().strip().split()))
s = input()
ans = 0
rt = 'abcdefghijklmnopqrstuvwxyz'
for i in rt:
	s = s.replace(i, '', a)
	a = a - (n - len(s))
	n = len(s)
	if a == 0:
		break
print(s)


(n, k) = map(int, input().split())
s = input()
times = [0] * 26
for c in s:
	times[ord(c) - ord('a')] += 1
m = 0
index = 0
while m + times[index] < k:
	m += times[index]
	index += 1
t = times[index]
if m + times[index] > k:
	t = k - m
ans = []
m = 0
for i in range(n):
	p = ord(s[i]) - ord('a')
	if p < index:
		continue
	elif p > index:
		ans.append(s[i])
	elif m < t:
		m += 1
	else:
		ans.append(s[i])
print(''.join(ans))


(n, m) = map(int, input().split())
s = input()
l = list(s)
l1 = [i for i in range(n)]
l2 = [(x, y) for (x, y) in zip(l, l1)]
l2 = sorted(l2, key=lambda x: x[0])
l2 = l2[m:]
l2 = sorted(l2, key=lambda x: x[1])
for i in range(len(l2)):
	print(l2[i][0], end='')


(n, k) = list(map(int, input().split()))
s = input()
d = {}
for x in sorted(s):
	if x not in d:
		d[x] = 0
	d[x] += 1
s1 = ''
for i in d.keys():
	c = d[i]
	d[i] -= k
	k = k - c
	if k <= 0:
		break
for i in s[::-1]:
	if d[i] > 0:
		s1 += i
		d[i] -= 1
print(s1[::-1])


(n, k) = map(int, input().split())
s = input()
l = 97
while k > 0:
	m = s.count(chr(l))
	s = s.replace(chr(l), '', min(m, k))
	k -= min(m, k)
	l += 1
print(s)


(n, k) = map(int, input().split())
s = str(input())
alphavite = 'abcdefghijklmnopqrstuvwxyz'
pos = 0
count = 0
t = 0
while True:
	lcount = s.count(alphavite[t])
	count += lcount
	if count < k:
		s = s.replace(alphavite[t], '')
	else:
		k = k - count + lcount
		count = 0
		for i in range(len(s)):
			if s[i] == alphavite[t]:
				count += 1
			if count == k:
				s = s[0:i + 1].replace(alphavite[t], '') + s[i + 1:len(s)]
				break
		break
	t += 1
print(s)


(n, k) = map(int, input().split())
s = list(input())
from collections import Counter
d = Counter(s)
t = 'abcdefghijklmnopqrstuvwxyz'
dd = {}
for i in t:
	dd[i] = min(d[i], k)
	k -= dd[i]
for i in range(n):
	if dd[s[i]]:
		dd[s[i]] -= 1
		s[i] = ''
print(''.join(s))


(n, k) = [int(__) for __ in input().strip().split()]
st = input().strip()
dic = {}
for i in range(len(st)):
	if st[i] in dic:
		dic[st[i]].append(i)
	else:
		dic[st[i]] = [i]
keys = sorted(list(dic.keys()))
for i in keys:
	if k > 0:
		if k > len(dic[i]):
			k -= len(dic[i])
			dic[i] = []
		else:
			dic[i] = dic[i][k:]
			k = 0
ans = []
for i in dic:
	ans += dic[i]
ans.sort()
for i in ans:
	print(st[i], end='')


(n, k) = map(int, input().split())
s = input()
dic = dict()
for item in s:
	if item not in dic:
		dic[item] = 1
	else:
		dic[item] += 1
alphabet = 'abcdefghijklmnopqrstuvwxyz'
en = ''
for item in alphabet:
	if item not in dic:
		continue
	if dic[item] <= k:
		k -= dic[item]
	else:
		en = item
		break
ans = ''
for item in s:
	if item > en:
		ans += item
	elif item == en and k == 0:
		ans += item
	elif item == en and k > 0:
		k -= 1
if en == '':
	print()
else:
	print(ans)


mod = 10 ** 9 + 7
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(n, k) = f()
l = sorted([[j, i] for (i, j) in enumerate(si())])
s2 = sorted(l[k:], key=lambda x: x[1])
[print(i[0], end='') for i in s2]


(n, k) = map(int, input().split())
s = input()
l = []
for i in range(len(s)):
	l.append([i, s[i]])
l.sort(key=lambda x: x[1])
l = l[k:]
l.sort()
s = ''
for a in l:
	s += a[1]
print(s)


(n, k) = map(int, input().split())
l = input()
arr = [0] * 26
for i in range(n):
	arr[ord(l[i]) - 97] += 1
a = [0] * 26
i = 0
while k > 0:
	if k >= arr[i]:
		a[i] = arr[i]
		k -= arr[i]
		i += 1
	else:
		a[i] = k
		break
ans = ''
for i in range(n):
	if a[ord(l[i]) - 97] > 0:
		a[ord(l[i]) - 97] -= 1
	else:
		ans += l[i]
print(ans)


import sys

def i_ints():
	return map(int, sys.stdin.readline().split())
(n, k) = i_ints()
s = input()
keeps = sorted(enumerate(s), key=lambda x: x[1])[k:]
print(''.join((x[1] for x in sorted(keeps))))


import collections, string
(n, k) = map(int, input().split())
s = input()
d = collections.Counter(s)
stri = string.ascii_lowercase
res = [0] * 26
for i in stri:
	cur = min(k, d[i])
	k -= cur
	d[i] -= cur
	res[ord(i) - ord('a')] += cur
	if k == 0:
		break
if k > 0:
	print()
else:
	ans = ''
	for i in s:
		if res[ord(i) - ord('a')] > 0:
			res[ord(i) - ord('a')] -= 1
			continue
		print(i, end='')


def fun(s, n, k):
	occ = [0] * 26
	for i in s:
		occ[ord(i) - 97] += 1
	r = k
	i = -1
	while r > 0:
		i += 1
		r -= occ[i]
	if i == -1:
		return ''
	last = occ[i] + r
	occ[i] = last
	ans = ''
	for j in s:
		ch = ord(j) - 97
		if ch <= i and occ[ch] > 0:
			occ[ch] -= 1
		else:
			ans += j
	return ans
(n, k) = map(int, input().split())
s = input()
print(fun(s, n, k))


(n, k) = map(int, input().split())
s = input()
print(''.join(map(lambda x: x[1], sorted(sorted(enumerate(s), key=lambda x: (x[1], x[0]))[k:]))))


(n, k) = map(int, input().split())
s = input()
a = [[] for i in range(26)]
for i in range(n):
	a[ord(s[i]) - 97].append(i)
for i in range(26):
	l = len(a[i])
	if k <= l:
		break
	k -= l
	a[i] = []
a[i] = a[i][k:]
r = [''] * n
for x in range(26):
	for i in a[x]:
		r[i] = chr(97 + x)
print(''.join(r))


(n, k) = map(int, input().split())
l = sorted(sorted([(x, y) for (x, y) in enumerate(input())], key=lambda x: x[1])[k:])
for i in l:
	print(i[1], end='')


from collections import defaultdict
(n, k) = map(int, input().split())
remaining = n - k
s = input()
alph = 'abcdefghijklmnopqrstuvwxyz'
translate = {c: i for (i, c) in enumerate(alph)}
occ = defaultdict(int)
for c in s:
	occ[c] += 1
remove_chars = set()
i = 0
c_sum = 0
while k > c_sum:
	c_sum += occ[alph[i]]
	remove_chars.add(alph[i])
	i += 1
occ[alph[i - 1]] += k - c_sum
new_s = ''
for c in s:
	if not k <= 0 and c in remove_chars:
		occ[c] -= 1
		k -= 1
		if occ[c] == 0:
			remove_chars.remove(c)
	else:
		new_s += c
if new_s:
	print(new_s)


(n, k) = map(int, input().split())
s = input()
cnt = [[] for _ in range(30)]
letters = set()
for i in range(n):
	c = ord(s[i]) - 97
	letters.add(c)
	cnt[c].append(i)
life = [True for _ in range(n)]
letters = sorted(list(letters))
c = 0
q = 0
for i in range(k):
	if len(cnt[letters[c]]) == q:
		c += 1
		q = 0
	i = cnt[letters[c]][q]
	q += 1
	life[i] = False
for i in range(n):
	if life[i]:
		print(s[i], end='')