The first line of the input is a string (between 1 and 50 characters long, inclusive). Each character will be a letter of English alphabet, lowercase or uppercase.

The second line of the input is an integer between 0 and 26, inclusive.
s = list(input())
d = int(input())


def min_exclude_upper(data):
    def normalize(a):
        return abs(ord(a) - ord('a'))

    mn = normalize('z')
    idx = 0
    for j, i in enumerate(data):
        if i.islower():
            if normalize(i) < mn:
                mn = normalize(i)
                idx = j
    return idx, mn


while d > 0:
    idx, cost = min_exclude_upper(s)
    d -= cost

    s[idx] = s[idx].upper()

print(*s, sep='')
