#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;  

char s[100005];
char a[30] = { '0', 'z', 'y', 'x', 'w', 'v', 'u', 't', 's', 'r', 'q', 'p', 'o', 'n', 'm', 'l', 'k', 'j', 'i', 'h', 'g', 'f', 'e', 'd', 'c', 'b', 'a'};
char b[30] = {'0','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'};

int find(char x){
	for(int i = 0; i <= 26; i++){
		if(a[i] == x) return i;
	}
}

int findb(char x){
	for(int i = 0; i <= 26; i++){
		if(b[i] == x) return i;
	}
}

int main()
{
	int k;
	cin >> s >> k;
	int len = strlen(s);
	for(int i = 0; i < len; i++){
		if(find(s[i]) <= k) k -= find(s[i]), s[i] = 'a';
		else continue;
	}
	cout << k << endl;
	if(k > 0) s[len-1] = b[findb(s[len-1]) + k];
	cout << s << endl;
	return 0;
}