#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  char ch[1000007], ch2[1000007];
  for (int i = 1; i <= n; i++) cin >> ch[i];
  long long idx = n;
  long long noti = 0;
  for (int i = k; i >= 1; i--) {
    if (ch[i] - '0' < 9) {
      for (int i = 1; i <= k; i++) {
        for (int j = i; j <= n; j += k) ch2[j] = ch[i];
      }
      for (int i = 1; i <= n; i++) {
        if ((ch2[i] - '0') < (ch[i] - '0')) noti = 1;
        if ((ch2[i] - '0') > (ch[i] - '0')) break;
      }
      if (noti == 1) {
        ch[i] = (ch[i] - '0' + 1) + '0';
        idx = i;
      }
      break;
    } else {
      for (int i = 1; i <= k; i++) {
        for (int j = i; j <= n; j += k) ch2[j] = ch[i];
      }
      for (int i = 1; i <= n; i++) {
        if ((ch2[i] - '0') < (ch[i] - '0')) {
          noti = 1;
        }
        if ((ch2[i] - '0') > (ch[i] - '0')) break;
      }
      if (noti == 0) {
        idx = i;
        break;
      }
    }
  }
  if (noti == 1) {
    for (int i = idx + 1; i <= k; i++) ch[i] = '0';
  }
  for (int i = 1; i <= k; i++)
    for (int j = i; j <= n; j += k) ch[j] = ch[i];
  cout << n << endl;
  for (int i = 1; i <= n; i++) cout << ch[i];
}
