content: import java.io.*;
  import java.math.*;
  import java.security.*;
  import java.text.*;
  import java.util.*;
  import java.util.concurrent.*;
  import java.util.regex.*;
  
  public class solution {
  
       private static String largestPalindrome(String number, int k) {
          char[] chars = number.toCharArray();
          int minChange = 0;
          for (int i = 0, j = chars.length - 1; i < j; i++, j--) {
              if (chars[i] != chars[j]) {
                  minChange++;
              }
          }
          if (minChange > k) {
              return "-1";
          }
          int changeBoth = k - minChange;
            
      // Iinitialize l and r by leftmost and 
      // rightmost ends 
          int i = 0;
          int j = chars.length - 1;
          for (; i <= j; i++, j--) {
              if (chars[i] != chars[j]) {
                   // Replace left and right character by  
              // maximum of both  
                  char maxChar = (char) Math.max(chars[i], chars[j]);
                  if (maxChar != '9' && changeBoth - 1 >= 0) {
                       /* If characters at ith or rth (one of them) is changed in the previous  
                  loop then subtract 1 from K (1 more is  
                  subtracted already) and make them 9 */ 
                      chars[i] = '9';
                      chars[j] = '9';
                      changeBoth--;
                  } else {
                      chars[i] = maxChar;
                      chars[j] = maxChar;
                      minChange--;
                  }
              } else {
                  char maxChar = (char) Math.max(chars[i], chars[j]);
                   /* If none of them is changed in the 
                 previous loop then subtract 2 from changeboth
                 and convert both to 9 */
                  if (maxChar != '9' && changeBoth - 2 >= 0) {
                      chars[i] = '9';
                      chars[j] = '9';
                      changeBoth -= 2;
                  }
              }
          }
          if (changeBoth != 0 && i - 1 == j + 1) {
              chars[i - 1] = '9';
          }
          String palindrome = new String(chars);
          return palindrome;
      }
  
      public static void main(String[] args) {
          Scanner in = new Scanner(System.in);
          int n = in.nextInt();
          int k = in.nextInt();
          String number = in.next();
          System.out.println(largestPalindrome(number, k));
      }
  }
  