# code-festival-2016-qualaC - 次のアルファベット / Next Letter

from string import ascii_lowercase as abc





def main():

    S = input().rstrip()

    K = int(input())

    N, MOD = len(S), 26

    # dist[c] := distance to "a" through "z"

    dist = {c: 26 - i for i, c in enumerate(abc)}

    dist["a"] = 0

    A = [dist[i] for i in S]

    for i in range(N):

        if A[i] and A[i] <= K:  # A[i] -> "a" if possible

            A[i], K = 0, K - A[i]

    A[-1] = (A[-1] - K) % MOD  # use the remaining K on A[-1]

    rest = {v: k for k, v in dist.items()}

    ans = [rest[i] for i in A]  # restore dist to chr

    print(*ans, sep="")





if __name__ == "__main__":

    main()

# code-festival-2016-qualaC - 次のアルファベット / Next Letter

from string import ascii_lowercase as abc





def main():

    S = input().rstrip()

    K = int(eval(input()))

    # dist[c] := distance to "a" through "z"

    dist = {c: 26 - i for i, c in enumerate(abc)}

    dist["a"] = 0

    A = [dist[i] for i in S]

    ans = ""

    for i, s in zip(A[:-1], S[:-1]):

        if 0 < i <= K:  # change s to "a" if possible

            ans += "a"

            K -= i

        else:

            ans += s

    # use the remaining K on A[-1] and combine with ans

    ans += chr((ord(S[-1]) + K - ord("a")) % 26 + ord("a"))

    print(ans)





if __name__ == "__main__":

    main()
# code-festival-2016-qualaC - 次のアルファベット / Next Letter
from string import ascii_lowercase as abc


def main():
    S = input().rstrip()
    K = int(input())
    N, MOD = len(S), 26
    # dist[c] := distance to "a" through "z"
    dist = {c: 26 - i for i, c in enumerate(abc)}
    dist["a"] = 0
    A = [dist[i] for i in S]
    for i in range(N):
        if A[i] and A[i] <= K:  # A[i] -> "a" if possible
            A[i], K = 0, K - A[i]
    A[-1] = (A[-1] - K) % MOD  # use the remaining K on A[-1]
    rest = {v: k for k, v in dist.items()}
    ans = [rest[i] for i in A]  # restore dist to chr
    print(*ans, sep="")


if __name__ == "__main__":
    main()

# code-festival-2016-qualaC - 次のアルファベット / Next Letter
from string import ascii_lowercase as abc


def main():
    S = input().rstrip()
    K = int(eval(input()))
    # dist[c] := distance to "a" through "z"
    dist = {c: 26 - i for i, c in enumerate(abc)}
    dist["a"] = 0
    A = [dist[i] for i in S]
    ans = ""
    for i, s in zip(A[:-1], S[:-1]):
        if 0 < i <= K:  # change s to "a" if possible
            ans += "a"
            K -= i
        else:
            ans += s
    # use the remaining K on A[-1] and combine with ans
    ans += chr((ord(S[-1]) + K - ord("a")) % 26 + ord("a"))
    print(ans)


if __name__ == "__main__":
    main()

-    K = int(input()) -    N, MOD = len(S), 26 +    K = int(eval(input())) -    for i in range(N): -        if A[i] and A[i] <= K:  # A[i] -> "a" if possible -            A[i], K = 0, K - A[i] -    A[-1] = (A[-1] - K) % MOD  # use the remaining K on A[-1] -    rest = {v: k for k, v in dist.items()} -    ans = [rest[i] for i in A]  # restore dist to chr -    print(*ans, sep="") +    ans = "" +    for i, s in zip(A[:-1], S[:-1]): +        if 0 < i <= K:  # change s to "a" if possible +            ans += "a" +            K -= i +        else: +            ans += s +    # use the remaining K on A[-1] and combine with ans +    ans += chr((ord(S[-1]) + K - ord("a")) % 26 + ord("a")) +    print(ans)