{-# LANGUAGE NoMonomorphismRestriction #-}
module Main (main) where
import qualified Data.Char as C

getInt :: IO Int
getInt = read <$> getLine
main = do
  s <- getLine
  k <- getInt
  let a = length $ solve k $ map toInt s
  print a
  putStrLn $ map toChar $ solve k $ map toInt s
  return ()

solve :: Int -> [Int] -> [Int]
solve 0 s = s
solve k [c] = [(c+k) `mod` 26]
solve k (h:s)
  | h == 0 = h:solve k s
  | otherwise = let (k',c') = update k h
                in c':solve k' s
  where
    update k c = let consume = (26 - c)
                 in if consume < k
                    then (k - consume, 0)
                    else (k, c)

toInt :: Char -> Int
toInt c = C.ord c - C.ord 'a'

toChar :: Int -> Char
toChar c = C.chr (c + C.ord 'a')
