#include <bits/stdc++.h>
using namespace std;
int A[11];
string tmpa;
int f(int dig, int i, int k) {
  if (k == 0) return (0);
  int newk = k;
  if (dig + i <= 9) {
    newk = max(0, newk - A[dig + i]);
    for (int ii = 0, kk = 0; ii < tmpa.length(), kk < k - newk; ii++)
      if (tmpa[ii] == dig + i + '0') {
        tmpa[ii] = dig + '0';
        kk++;
      }
  }
  int buf = newk;
  if (dig - i >= 0) {
    newk = max(0, newk - A[dig - i]);
    for (int ii = tmpa.length() - 1, kk = 0; ii >= 0, kk < buf - newk; ii--)
      if (tmpa[ii] == dig - i + '0') {
        tmpa[ii] = dig + '0';
        kk++;
      }
  }
  int res = (k - newk) * i;
  return (res + f(dig, i + 1, newk));
}
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    A[s[i] - '0']++;
  }
  int res = INT_MAX;
  string ans;
  for (int i = 0; i < 10; i++) {
    tmpa = s;
    int tmp = f(i, 1, max(0, k - A[i]));
    if (res == tmp) {
      ans = min(ans, tmpa);
      continue;
    }
    if (res > tmp) {
      res = tmp;
      ans = tmpa;
    }
  }
  cout << res << endl;
  cout << ans;
exit:
  return (0);
}
