#include <bits/stdc++.h>
using namespace std;
const int xx[4] = {1, -1, 0, 0};
const int yy[4] = {0, 0, 1, -1};
int n, k;
string s;
int cnt[10], num[10];
pair<int, string> ans(1000000000, "~");
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k >> s;
  for (int i = 0; i < ((int)(s).size()); i++) cnt[s[i] - '0']++;
  for (int dig = 0; dig < 10; dig++) {
    memset(num, 0, sizeof(num));
    for (int i = 0; i < 10; i++) {
      num[abs(dig - i)] += cnt[i];
    }
    int cr = k, pos = 0;
    while (cr > 0) {
      if (num[pos] >= cr) {
        num[pos] = cr;
        pos++;
        while (pos < 10) {
          num[pos] = 0;
          pos++;
        }
        break;
      }
      cr -= num[pos];
      pos++;
    }
    int cost = 0;
    string tmp = s;
    num[0] = 0;
    for (int i = 0; i < ((int)(s).size()); i++) {
      if (num[abs(tmp[i] - '0' - dig)] > 0 && s[i] - '0' > dig) {
        num[abs(s[i] - '0' - dig)]--;
        tmp[i] = '0' + dig;
        cost += s[i] - '0' - dig;
      }
    }
    for (int i = ((int)(s).size()) - 1; i >= 0; i--) {
      if (num[abs(tmp[i] - '0' - dig)] > 0) {
        num[abs(s[i] - '0' - dig)]--;
        tmp[i] = '0' + dig;
        cost += abs(s[i] - '0' - dig);
      }
    }
    ans = min(ans, make_pair(cost, tmp));
  }
  cout << ans.first << endl;
  cout << ans.second << endl;
  return 0;
}
