#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <map>

using namespace std;

typedef long long ll;
const int N = 1e5+10;
const ll Maxn = 1e16;

char s[N],ss[N];
int a[N], b[N];
//97 122;
int main(){
	int k;
	scanf("%s",s);
	scanf("%d", &k);
	int l = strlen(s);
	for(int i = 0; i < l; i++){
		if(s[i] == 'a')
			a[i] = -100;
		else
			a[i] = (s[i] - '0' + '0') - 123;
		b[i] = a[i];
	}
//	printf("%d",a[0]);
	for(int i = 0; i < l; i++){
		int x = k + a[i];
		if(x >= 0){
			k += a[i];
			s[i] = 'a';
			a[i] = -100;
			b[i] = a[i];
		}
		else break;
	}
	sort(b, b + l);
	int sum = 0;
	int kk = k;
	for(int i = l - 1; i >= 0; i--){
		int x = kk + b[i];
		if(x >= 0){
			kk += b[i];
			sum++;
		}
		if(x < 0 && kk > 0) {sum++;break;}
	}
//	printf("%d\n",sum);
	if(sum == 1){
		int maxx = -110;
		int pp;
		for(int j = 0; j < l; j++){
			if(maxx <= a[j]){
				maxx = a[j];
				pp = j;
			}
		}
		int x = a[pp] + k;
		if(x == 0) s[pp] = 'a';
		else if(x < 0) s[pp] = s[pp] + k;
	}
	else{
		for(int i = 0; i < sum; i++){
			for(int j = 0; j < l; j++){
				if(a[j] == b[l-i-1]){
					s[j] = 'a'; 
					a[j] == -100;
					break;
				}
			}
		}
	}
/*	for(int i = 122; i > 97; i++){
		for(int j = 0; j < l; j++){
			int x = a[j] - '0' + '0';
			int y = a[j] - 123;
			int z = y + k;
			if(z >= 0 && x == i){
				s[i] = 'a';
				k += y;
			}
			else if(x == i){
				s[i] += k;
				k == 0;
			}
		}
	}*/

	for(int i = 0; i < l; i++)
		printf("%c", s[i]);
	printf("\n");
}
