let rec solve s k i =
  if i = String.length s - 1 then
    s.[i] <- Char.chr @@
      (Char.code s.[i] - Char.code 'a' + k) mod 26 + Char.code 'a'
  else if s.[i] = 'a' || Char.code s.[i] + k < Char.code 'z' + 1 then
    solve s k (i + 1)
  else begin
    let c = s.[i] in
    s.[i] <- 'a';
    solve s (k - Char.code 'z' - 1 + Char.code c) (i + 1)
  end

let () = Scanf.scanf "%s\n%d\n" @@ fun s k ->
  solve s k 0;
  print_endline s

