#include <bits/stdc++.h>
#pragma GCC optimize("-O2")
using namespace std;
const int N = 1e5 + 5, MOD = 1e9 + 7;
const long double EPS = 1e-9;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int i, j, n, k;
  bool fl = false;
  cin >> n >> k;
  int a[n], b[n];
  string s;
  cin >> s;
  for (int i = 0; i < n; ++i) a[i] = s[i] - '0';
  for (int i = 0; i < n; ++i) b[i] = a[i];
  bool ch = true;
  for (i = 0; i < k; i++) {
    for (j = i; j < n; j += k) {
      if (a[j] != a[i]) ch = false;
    }
  }
  if (ch) {
    cout << n;
    cout << '\n';
    for (int i = 0; i < n; ++i) cout << a[i];
    exit(0);
  }
  for (i = 0; i < k; i++) {
    for (j = i; j < n; j += k) {
      b[j] = b[i];
    }
  }
  for (int i = 0; i < n; ++i) {
    if (b[i] == a[i])
      continue;
    else if (b[i] > a[i]) {
      fl = false;
      break;
    } else {
      fl = true;
      break;
    }
  }
  if (!fl) {
    cout << n;
    cout << '\n';
    for (int i = 0; i < n; ++i) cout << b[i];
  } else {
    cout << n;
    cout << '\n';
    for (i = k - 1; i >= 0; i--) {
      if (b[i] == 9) {
        for (j = i; j < n; j += k) b[j] = 0;
      } else {
        int temp = b[i];
        for (j = i; j < n; j += k) b[j] = temp + 1;
        break;
      }
    }
    for (int i = 0; i < n; ++i) cout << b[i];
  }
  return 0;
}
