You are given an integer $x$ of $n$ digits $a_1, a_2, \ldots, a_n$, which make up its decimal notation in order from left to right.

Also, you are given a positive integer $k < n$.

Let's call integer $b_1, b_2, \ldots, b_m$ beautiful if $b_i = b_{i+k}$ for each $i$, such that $1 \leq i \leq m - k$.

You need to find the smallest beautiful integer $y$, such that $y \geq x$. 


-----Input-----

The first line of input contains two integers $n, k$ ($2 \leq n \leq 200\,000, 1 \leq k < n$): the number of digits in $x$ and $k$.

The next line of input contains $n$ digits $a_1, a_2, \ldots, a_n$ ($a_1 \neq 0$, $0 \leq a_i \leq 9$): digits of $x$.


-----Output-----

In the first line print one integer $m$: the number of digits in $y$.

In the next line print $m$ digits $b_1, b_2, \ldots, b_m$ ($b_1 \neq 0$, $0 \leq b_i \leq 9$): digits of $y$.


-----Examples-----
Input
3 2
353

Output
3
353

Input
4 2
1234

Output
4
1313

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Greedy algorithms

String algorithms

Implementation

Constructive algorithms


Solutions:
INF = 10 ** 10

def main():
	print = out.append
	(n, k) = get_list()
	li = input()
	x = int(li[:k])
	print(n)
	expand = lambda x: (str(x) * ((n + k - 1) // k))[:n]
	k1 = expand(x)
	if k1 >= li:
		print(k1)
	else:
		print(expand(x + 1))
import sys
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
main()
print(*out, sep='\n')


(n, k) = map(int, input().split(' '))
s = list(map(int, list(input())))
l = s[:k]
flag = 0
f = 0
d = 0
for i in range(n):
	if s[i] < l[i % k]:
		f = 1
	if s[i] > l[i % k] and f != 1:
		d = 1
if d == 1:
	t = k - 1
	while t >= 0 and l[t] == 9:
		t -= 1
	if t == -1:
		flag = 1
		print(len(s))
		for j in range(len(s)):
			print(l[j % k], end='')
	else:
		l[t] += 1
		flag = 1
		for j in range(t + 1, len(l)):
			l[j] = 0
		print(len(s))
		for j in range(len(s)):
			print(l[j % k], end='')
if flag == 0:
	print(len(s))
	for j in range(len(s)):
		print(l[j % k], end='')


import sys
input = sys.stdin.readline
(n, k) = list(map(int, input().split()))
a = list(input())
for i in range(n):
	a[i] = int(a[i])
for i in range(n):
	if a[i] < a[i % k]:
		b = [0] * n
		for i in range(n):
			b[i] = a[i % k]
		print(n)
		print(''.join(map(str, b)))
		return
	if a[i] > a[i % k]:
		break
else:
	b = [0] * n
	for i in range(n):
		b[i] = a[i % k]
	print(n)
	print(''.join(map(str, b)))
	return
for i in range(k)[::-1]:
	if i == k - 1 and a[i] != 9:
		a[i] += 1
		break
	if a[i] == 9:
		a[i] = 0
	else:
		a[i] += 1
		break
for i in range(n):
	a[i] = a[i % k]
print(n)
print(''.join(map(str, a)))


def get():
	return (a[:k] * (n // k + 1))[:n]

def get2():
	return (str(int(a[:k]) + 1) * (n // k + 1))[:n]
(n, k) = map(int, input().split())
a = input()
print(n)
r1 = get()
if int(r1) >= int(a):
	print(r1)
else:
	print(get2())


(n, k) = map(int, input().split())
a = input()
print(n)
b = a[0:k] * (len(a) // k) + a[:len(a) - len(a) // k * k]
arrf = ''.join([str(i) for i in b])
if int(arrf) >= int(a):
	print(arrf)
else:
	c = a[:k]
	arr = ''.join([str(i) for i in c])
	arr = str(int(arr) + 1)
	c = list(arr)
	b = c[0:k] * (len(a) // k) + c[:len(a) - len(a) // k * k]
	arrf = ''.join([str(i) for i in b])
	print(arrf)


def solve(n, k, A):
	n = len(A)
	mod = n % k
	Y = A[:k]
	for i in range(n // k):
		astr = A[i * k:i * k + k]
		if astr != Y:
			a = int(astr)
			ynum = int(Y)
			if a < ynum:
				return Y * (n // k) + Y[:mod]
			B = str(ynum + 1)
			return B * (n // k) + B[:mod]
	if mod != 0:
		astr = A[-mod:]
		if astr != Y[:mod]:
			ynum = int(Y[:mod])
			a = int(astr)
			if a < ynum:
				return Y * (n // k) + Y[:mod]
			if n > k:
				B = str(int(A[:k]) + 1)
				return B * (n // k) + B[:mod]
			return str(ynum + 1)
	return A
(n, k) = map(int, input().split())
A = input()
ans = solve(n, k, A)
print(len(ans))
print(ans)


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = mpos(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj
import sys
import threading
from math import *
sys.setrecursionlimit(300000)
threading.stack_size(10 ** 8)
po = int(log(10 ** 18)) + 2
li = []
for i in range(po):
	li.append(3 ** i)
li = li[::-1]
s = sum(li)
for _ in range(1):
	(n, k) = map(int, input().split())
	a = list(input())
	a = [int(x) for x in a]
	b = []
	for i in range(k):
		b.append(a[i])
	for i in range(k, n):
		b.append(b[i - k])
	if b < a:
		i = k - 1
		while b[i] == 9:
			b[i] = 0
			i -= 1
		b[i] += 1
	for i in range(k, n):
		b[i] = b[i - k]
	print(n)
	print(*b, sep='')


def solve(case):
	(n, k) = map(int, input().split())
	s = list(input())
	for i in range(n):
		s[i] = int(s[i])
	new = []
	for i in range(k):
		new.append(s[i])
	for i in range(k, n):
		new.append(s[i % k])
	if int(''.join((str(s[i]) for i in range(n)))) <= int(''.join((str(new[i]) for i in range(n)))):
		print(n)
		print(''.join((str(new[i]) for i in range(n))))
		return
	ind = k - 1
	while s[ind] == 9:
		s[ind] = 0
		ind -= 1
	s[ind] += 1
	ans = []
	for i in range(k):
		ans.append(s[i])
	for i in range(k, n):
		ans.append(ans[i % k])
	print(n)
	print(''.join((str(ans[i]) for i in range(n))))
solve(1)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout
from heapq import heappush, heappop, heapify, _heapify_max, _heappop_max, nsmallest, nlargest

def main():
	mod = 998244353
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	tc = 1
	for _ in range(tc):
		(n, k) = ria()
		a = rs()
		s = a[:k] * (n // k + 1)
		s = s[:n]
		print(n)
		if s >= a:
			print(s)
		else:
			s = str(int(a[:k]) + 1) * (n // k + 1)
			s = s[:n]
			print(s)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


import sys
input = sys.stdin.readline
(n, k) = list(map(int, input().split()))
A = input().strip()
A += '0' * (k - n % k)
x = A[:k]
flag = 0
for i in range(0, len(A), k):
	if A[i:i + k] > x:
		flag = 1
		break
	elif A[i:i + k] == x:
		continue
	else:
		break
if flag == 0:
	ANS = (x * (len(A) // k))[:n]
else:
	ANS = (str(int(x) + 1) * (len(A) // k))[:n]
print(len(ANS))
print(ANS)
print()


(n, k) = map(int, input().split())
a = input()
q = a[:k]
qlen = len(q)
p = 10 ** (n - k)
test = str(int(a) // p)
m = len(a)
v = q * (m // qlen) + q[:m % qlen]
if v < a:
	q = str(int(q) + 1)
	v = q * (m // qlen) + q[:m % qlen]
print(m)
print(v)


(n, k) = list(map(int, input().split()))
num = input()
num = list(num)
ans = []
while len(ans) < n:
	ans += num[:k]
ans = ans[:n]
x = ''.join(ans)
y = ''.join(num)
if y > x:
	for i in range(k - 1, -1, -1):
		if num[i] != '9':
			num[i] = str(int(num[i]) + 1)
			break
		else:
			num[i] = '0'
ans = []
while len(ans) < n:
	ans += num[:k]
ans = ans[:n]
print(len(ans))
print(''.join(ans))


(n, k) = map(int, input().split())
a = input()
d = a[0:k]
c = int(d)
b = d * (n // k)
print(n)
b += d[0:n % k]
if b >= a:
	print(b)
else:
	c += 1
	d = str(c)
	b = d * (n // k)
	b += d[0:n % k]
	print(b)


(n, k) = map(int, input().split())
a = input().strip()
print(n)
for j in (0, 1):
	b = (str(int(a[:k]) + j) * (n // k + 1))[:n]
	if b >= a:
		print(b)
		break


(N, K) = map(int, input().split())
List = input()
prev = List[:K] * int(N // K) + List[:N % K]
if prev >= List:
	print(N)
	print(prev)
else:
	x = str(int(List[:K]) + 1)
	prev = x * int(N // K) + x[:N % K]
	print(N)
	print(prev)


(n, k) = map(int, input().split())
x = list(input())
ans = ['0'] * n
print(n)
for i in range(k):
	ans[i] = x[i]
	j = i + k
	while j < n:
		ans[j] = ans[j - k]
		j += k
good = True
for i in range(n):
	if ans[i] > x[i]:
		break
	elif ans[i] < x[i]:
		good = False
		break
if good:
	print(''.join(ans))
	exit(0)
for i in range(k - 1, -1, -1):
	if ans[i] != '9':
		ans[i] = chr(ord(ans[i]) + 1)
		for j in range(i + 1, k):
			if ans[j] == '9':
				ans[j] = '0'
		break
for i in range(k):
	j = i + k
	while j < n:
		ans[j] = ans[j - k]
		j += k
print(''.join(ans))


import os
import sys
from io import BytesIO, IOBase

def main():
	(n, k) = map(int, input().split(' '))
	a = list(map(int, list(input())))
	ans = [-1 for x in range(n)]
	for x in range(k):
		for y in range(x, n, k):
			if ans[y] == -1:
				ans[y] = a[x]
	if ''.join(map(str, ans)) >= ''.join(map(str, a)):
		print(n)
		print(''.join(map(str, ans)))
	else:
		if ans[k - 1] != 9:
			for y in range(k - 1, n, k):
				ans[y] = ans[y] + 1
		else:
			temp = k - 1
			while temp > 0 and ans[temp] == 9:
				ans[temp] = 0
				temp -= 1
			if temp == -1:
				ans.insert(1, 0)
			else:
				ans[temp] += 1
			for x in range(k):
				for y in range(x + k, n, k):
					ans[y] = ans[x]
		print(len(ans))
		print(''.join(map(str, ans)))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
(n, k) = map(int, sys.stdin.readline().rstrip().split())
s = sys.stdin.readline().rstrip()
s.rstrip()
basic = [int(i) for i in s]
for i in range(k, n):
	basic[i] = basic[i - k]
i = k - 1
while i >= 0 and basic[i] + 1 == 10:
	i -= 1
num = ''.join(map(str, basic))
if num >= s:
	print(len(basic))
	print(''.join(map(str, basic)))
elif i < 0:
	print(n)
	print('9' * n)
else:
	for j in range(i + 1, min(i + k, n)):
		basic[j] = 0
	for j in range(k, n):
		basic[j] = basic[j - k]
	num = int(''.join(map(str, basic)))
	if num < int(s):
		while i < n:
			basic[i] += 1
			i += k
	print(len(basic))
	print(''.join(map(str, basic)))


(n, k) = map(int, input().split())
string = input()
new_string = (string[:k] * (n // k + 1))[:n]
if new_string >= string:
	print(n)
	print(new_string)
else:
	ans = int(new_string[:k]) + 1
	ans = (str(ans) * (n // k + 1))[:n]
	print(len(ans))
	print(ans)


(n, k) = map(int, input().split())
a = input()
aSub = a[:k]
ans = ''
for i in range(n):
	ans += aSub[i % k]
if int(ans) < int(a):
	aSub = str(int(aSub) + 1)
	ans = ''
	for i in range(n):
		ans += aSub[i % k]
print(n)
print(ans)


(n, k) = map(int, input().split())
aa = input()
a = []
for i in range(n):
	a.append(int(aa[i]))
visit = a[:k]
i = k
while i < n:
	if a[i] < visit[i % k]:
		break
	elif a[i] > visit[i % k]:
		l = k - 1
		while visit[l] == 9:
			visit[l] = 0
			l -= 1
		visit[l] += 1
		break
	i += 1
print(n)
for i in range(n):
	print(visit[i % k], end='')


(n, k) = list(map(int, input().split()))
o = s = input()
s = s[:k]
d1 = (s * (n // k + 1))[:n]
d2 = (str(int(s) + 1) * (n // k + 1))[:n]
print(n)
if d1 >= o:
	print(d1)
else:
	print(d2)


(n, m) = map(int, input().split())
p = input()
t = list(p)
s = list(p)
print(n)
for i in range(m, n):
	t[i] = t[i - m]
if t >= s:
	print(''.join(t))
else:
	for j in range(m - 1, -1, -1):
		if int(t[j]) == 9:
			t[j] = str(int(0))
		else:
			t[j] = str(int(t[j]) + 1)
			break
	for i in range(m, n):
		t[i] = t[i - m]
	print(''.join(t))


import sys, math, cmath, time
start_time = time.time()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def solve():
	(n, k) = invr()
	a = list(insr())
	b = a[:k]
	q = []
	while len(q) < n:
		q += b
	q = q[:n]
	if ''.join(a) > ''.join(q):
		for i in reversed(range(k)):
			if a[i] != '9':
				b[i] = str(int(a[i]) + 1)
				break
			else:
				b[i] = '0'
	q = []
	while len(q) < n:
		q += b
	q = q[:n]
	print(len(q))
	print(''.join(q))

def main():
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
	sys.stdout.close()

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


(n, k) = map(int, input().split())
a = list(input())
b = a[:]
for i in range(k):
	for j in range(i + k, n, k):
		b[j] = b[i]
if ''.join(b) < ''.join(a):
	for i in range(k - 1, -1, -1):
		m = str(int(b[i]) + 1)
		if m != '10':
			for j in range(i, n, k):
				b[j] = m
			break
		else:
			for j in range(i, n, k):
				b[j] = '0'
print(n)
print(''.join(b))


(n, k) = map(int, input().split())
a = input()
first_k = a[:k]
no_change = []
for i in range(n):
	no_change.append(first_k[i % k])
no_change = ''.join(no_change)
if no_change >= a:
	print(n)
	print(no_change)
else:
	first_k = str(int(first_k) + 1)
	add_one = []
	for i in range(n):
		add_one.append(first_k[i % k])
	print(n)
	print(''.join(add_one))


(n, k) = map(int, input().split())
a = list(map(int, input()))
b = a[:]
for i in range(k):
	j = 1
	while i + j * k < n:
		b[i + j * k] = b[i]
		j += 1
if b < a:
	inc = k - 1
	while b[inc] == 9 and inc > 0:
		inc -= 1
	if b[inc] != 9:
		b[inc] += 1
		for i in range(inc + 1, k):
			b[i] = 0
		for i in range(inc, k):
			j = 1
			while i + j * k < n:
				b[i + j * k] = b[i]
				j += 1
	else:
		b = [1] + [0] * (k - 1)
		b = b * (n // k + 1)
		b = b[:n + 1]
print(len(b))
print(''.join(map(str, b)))


from sys import stdin, stdout
(n, k) = map(int, input().split(' '))
x = input()

def getAns(n, k, x):
	xi = int(x)
	pref = x[0:k]
	newnum = ''
	while newnum < x:
		newnum = pref * (n // k)
		newnum += pref[:n % k]
		if len(newnum) > len(x) or newnum >= x:
			stdout.write(str(len(newnum)) + '\n')
			stdout.write(str(newnum))
			return
		pref = str(int(pref) + 1)
getAns(n, k, x)


(N, K) = map(int, input().split())
L = list(input())
S = L.copy()
for i in range(K, N):
	S[i] = S[i - K]
if S >= L:
	print(N)
	print(''.join(S))
else:
	for i in range(K - 1, -1, -1):
		if S[i] != '9':
			for i in range(i, N, K):
				S[i] = str(int(S[i]) + 1)
			break
		else:
			for i in range(i, N, K):
				S[i] = '0'
	print(N)
	print(''.join(S))


import sys
readline = sys.stdin.readline
(N, K) = map(int, readline().split())
A = readline().strip()
num = A[:K] * (N // K) + A[:N % K]
ans = num
if num < A:
	ans = str(int(A[:K]) + 1)
	ans = ans * (N // K) + ans[:N % K]
print(len(ans))
print(ans)


def main():
	(n, k) = map(int, input().split())
	s = input()
	m = (n + k - 1) // k
	p = s[:k] * m
	p = p[:n]
	if p < s:
		ss = list(s[:k])
		if int(ss[k - 1]) + 1 == 10:
			carry = 1
			ss[k - 1] = '0'
			pointer = k - 2
			while pointer >= 0 and carry > 0:
				if int(ss[pointer]) < 9:
					ss[pointer] = str(int(ss[pointer]) + 1)
					carry = 0
					break
				else:
					ss[pointer] = '0'
					pointer -= 1
		else:
			ss[k - 1] = str(int(ss[k - 1]) + 1)
		ss = ''.join(ss)
		p = ss[:k] * m
		p = p[:n]
	print(n)
	print(p)
	return
main()


(n, k) = map(int, input().split())
a = list(str(input()))
f = ''
a = ''.join(a)
h = a[0:k] * (n // k + 1)
h = h[0:n]
if h == a:
	print(n)
	print(h)
else:
	t = a[0:k]
	f = t * (n // k + 1)
	f = f[0:n]
	if f > a:
		print(n)
		print(f)
	else:
		t = str(int(a[0:k]) + 1)
		if len(t) > k:
			t = '9' * k
			f = t * (n // k + 1)
		else:
			f = t * (n // k + 1)
		print(n)
		print(f[0:n])


(n, k) = map(int, input().split())
a = list(input())
ans = a
print(n)
flag = 1
for i in range(n):
	if ans[i] != ans[i % k]:
		flag = -1
if flag == 1:
	xx = ''
	xx = xx.join(ans)
	print(xx)
else:
	aa = ''
	aa = aa.join(a)
	aa = int(aa)
	for i in range(n):
		if i >= k:
			ans[i] = ans[i % k]
	xx = ''
	xx = xx.join(ans)
	anss = int(xx)
	if anss >= aa:
		print(xx)
	else:
		cm = -21
		for i in range(k):
			if ans[i] < '9':
				cm = i
		for i in range(n):
			if i == cm:
				ans[i] = int(ans[i]) + 1
			elif i > cm and i < k:
				ans[i] = '0'
			elif i >= k:
				ans[i] = ans[i % k]
		for i in range(n):
			print(ans[i], end='')


(n, k) = map(int, input().split())
a = list(map(int, input()))
ans = [-1] * n
upper = False
lower = False
for i in range(k):
	ans[i] = a[i]
for i in range(k, n):
	ans[i] = ans[i - k]
	if ans[i] == a[i]:
		pass
	elif ans[i] > a[i]:
		if lower == False and upper == False:
			upper = True
	elif lower == False and upper == False:
		lower = True
		for j in range(k - 1, -1, -1):
			if ans[j] != 9:
				break
		for l in range(i + 1):
			if l % k == j:
				ans[l] += 1
			elif l % k > j:
				ans[l] = 0
print(n)
print(''.join(map(str, ans)))


import math
(n, k) = map(int, input().split())
s = list(input())
s = [int(s[i]) for i in range(n)]
b = [0] * n
for i in range(k):
	b[i] = s[i]
for i in range(k, n):
	b[i] = b[i - k]
if b < s:
	i = k - 1
	while b[i] == 9:
		b[i] = 0
		i -= 1
	b[i] += 1
	for i in range(k, n):
		b[i] = b[i - k]
print(n)
print(*b, sep='')


(n, k) = map(int, input().split())
number = input()
until_k = number[:k]
(times, reminder) = (n // k, n % k)
rem_part = number[:reminder]
if until_k * times + rem_part < number:
	until_k = int(until_k)
	until_k += 1
	until_k = str(until_k)
rem_part = until_k[:reminder]
print(n, until_k * times + rem_part, sep='\n')


(n, k) = map(int, input().split())
s = list(map(int, input()))
pos = n
for i in range(n - k - 1, -1, -1):
	if s[i] != s[i + k]:
		pos = i + k
if pos != n:
	while True:
		if pos - k < 0 or s[pos] == s[pos - k]:
			for i in range(pos + 1, n):
				if i - k >= 0:
					s[i] = s[i - k]
				else:
					s[i] = 0
			break
		else:
			s[pos] += 1
			while s[pos] > 9:
				pos -= 1
				s[pos] += 1
print(len(s))
print(''.join(map(str, s)))


(n, k) = map(int, input().split())
s = input()
t = s[:k]
ans = t
for i in range(k, n):
	ans += ans[i - k]
if ans >= s:
	print(len(ans))
	print(ans)
else:
	t = s[:k]
	t = str(int(t) + 1)
	ans = t
	for i in range(k, n):
		ans += ans[i - k]
	print(len(ans))
	print(ans)


import sys
import math
(n, k) = map(int, input().split())
x = list(input())
x1 = []
x2 = []
while len(x1) < len(x):
	for i in range(k):
		if len(x1) == len(x):
			break
		x1.append(x[i])
flag = True
for i in range(n):
	if int(x1[i]) > int(x[i]):
		break
	if x1[i] < x[i]:
		flag = False
		break
if flag:
	print(len(x1))
	print(''.join(x1))
else:
	temp = list(x[:k])
	cur = []
	f = True
	for i in range(k - 1, -1, -1):
		if f:
			if int(temp[i]) < 9:
				cur.append(str(int(temp[i]) + 1))
				f = False
			else:
				cur.append('0')
		else:
			cur.append(temp[i])
	if f:
		print(n)
		x2 = []
		for _ in range(n):
			x2.append('9')
		print(''.join(x2))
	else:
		cur = cur[::-1]
		while len(x2) < len(x):
			for i in range(k):
				if len(x2) == len(x):
					break
				x2.append(cur[i])
		print(n)
		print(''.join(x2))


(n, k) = map(int, input().split())
dig = str(input())
rep = n // k
rem = n % k
portion = dig[0:k]
first = portion * rep + portion[:rem]
print(n)
if int(first) >= int(dig):
	print(first)
else:
	portion = str(int(dig[0:k]) + 1)
	second = portion * rep + portion[:rem]
	print(second)


(n, k) = map(int, input().split())
print(n)
x = input()
a = x[0:k]
for i in range(k, n):
	if int(x[i]) < int(a[i % k]):
		print((a * ((n + k - 1) // k))[0:n])
		exit()
	if int(x[i]) > int(a[i % k]):
		a = str(int(a) + 1)
		print((a * ((n + k - 1) // k))[0:n])
		exit()
print((a * ((n + k - 1) // k))[0:n])


(n, k) = [int(x) for x in input().split()]
b = list(input())
b = [int(x) for x in b]

def comp(a, b):
	for i in range(len(a)):
		if a[i] < b[i]:
			return True
		if a[i] > b[i]:
			return False
	return False
a = b[:k] * (n // k) + b[:n % k]
if comp(a, b):
	j = k - 1
	while b[j] == 9 and j >= 0:
		b[j] += 1
		b[j] %= 10
		j -= 1
	if j >= 0:
		b[j] += 1
	a = b[:k] * (n // k) + b[:n % k]
print(len(a))
print(''.join((str(x) for x in a)))


(p, k) = map(int, input().split())
s = str(input())
s1 = ''
print(p)
for i in range(len(s)):
	s1 += s[i % k]
if s1 >= s:
	print(s1)
else:
	l = list(s)
	for i in range(k - 1, -1, -1):
		if s[i] == '9':
			l[i] = '0'
		else:
			l[i] = chr(ord(s[i]) + 1)
			break
	for i in range(k, p):
		l[i] = l[i % k]
	print(''.join(map(str, l)))


(n, k) = map(int, input().split())
a = input()
s = a[:k]
for i in range(k, n):
	if a[i] < s[i % k]:
		break
	if a[i] > s[i % k]:
		s = str(int(s) + 1)
		break
print(n, s * (n // k) + s[:n % k], sep='\n')


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('0') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
(n, k) = inputnums()
t = inputstringnum()
ans = t[0:k]
for i in range(k, n):
	ans.append(ans[i - k])
small = False
for i in range(n):
	if ans[i] > t[i]:
		break
	elif ans[i] < t[i]:
		small = True
		break
if small:
	for i in reversed(range(k)):
		if ans[i] == 9:
			ans[i] = 0
		else:
			ans[i] += 1
			break
for i in range(k, n):
	ans[i] = ans[i - k]
print(len(ans))
for i in range(n):
	print(ans[i], end='')


def solve():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().strip()))
	f = False
	for i in range(k, n):
		if arr[i] > arr[i % k]:
			f = True
		elif arr[i] < arr[i % k]:
			break
	if f:
		for i in range(k - 1, -1, -1):
			if arr[i] != 9:
				arr[i] += 1
				break
			else:
				arr[i] = 0
	print(n)
	print(*map(lambda x: arr[x % k], range(n)), sep='')
solve()


(n, k) = map(int, input().split())
a = str(int(input()))
q = a[:k]
qlen = len(q)
v = q * (n // qlen) + q[:n % qlen]
if v < a:
	q = str(int(q) + 1)
	v = q * (n // qlen) + q[:n % qlen]
print(n)
print(v)


import sys
(n, k) = map(int, sys.stdin.readline().split())
s = sys.stdin.readline()[:-1]
l = list(s)
temp = [i for i in l]
i = k - 1
j = k - 1
while j >= 0:
	b = j
	while b < n:
		temp[b] = temp[j]
		b += k
	j -= 1
(x, m) = (True, True)
for i in range(n):
	if int(temp[i]) > int(s[i]):
		x = False
		break
	if int(temp[i]) < int(s[i]):
		m = False
		break
if not x:
	print(n)
	print(''.join((str(x) for x in temp)))
elif x and m:
	print(n)
	print(''.join((str(x) for x in temp)))
else:
	i = k - 1
	while i >= 0:
		if s[i] == '9':
			i -= 1
		else:
			j = i
			while j < n:
				temp[j] = str(int(s[i]) + 1)
				j += k
			break
	if i == -1:
		ans = '10' * (n // 2)
		if n & 1:
			ans = ans + '1'
		print(len(ans))
		print(ans)
	else:
		for j in range(i):
			a = j
			while a < n:
				temp[a] = temp[j]
				a += k
		for j in range(i + 1, k):
			a = j
			while a < n:
				temp[a] = '0'
				a += k
		print(len(temp))
		print(''.join((str(x) for x in temp)))


from collections import OrderedDict
(n, m) = list(map(int, input().split(' ')))
s = input()
v = s[:m]
s = int(s)
if s > int((v * (n // m + 1))[:n]):
	i = m - 1
	while i >= 0 and v[i] == '9':
		i -= 1
	if i < 0:
		v = '1' + '0' * (m - 1)
		print(n + 1)
		print((v * (n // m + 1))[:n + 1])
	else:
		v = v[:i] + chr(ord(v[i]) + 1) + '0' * len(v[i + 1:])
		print(n)
		print((v * (n // m + 1))[:n])
else:
	print(n)
	print((v * (n // m + 1))[:n])


import sys
import math
(n, k) = map(int, input().split())
s = input()
ans = ''
last = 1
ans = s[:k]
ans = ans * (n // k) + ans[:n % k]
s = s.strip()
ans = ans.strip()
if ans >= s:
	print(len(ans))
	print(ans)
else:
	act = s[:k]
	act = str(int(act) + 1)
	ans = act * (n // k) + act[:n % k]
	print(len(ans))
	print(*ans, sep='')


import sys
(n, k) = [int(i) for i in sys.stdin.readline().split()]
xx = input()
x = list(xx)
for i in range(n):
	x[i] = int(x[i])
xx = int(xx)
b = x[:]
for i in range(n - k):
	b[i + k] = b[i]
s = ''
for i in b:
	s += str(i)
if int(s) < xx:
	new = int(s[:k])
	new += 1
	s = str(new)
	ans = ''
	for i in range(n):
		ans += s[i % len(s)]
	print(len(ans))
	print(ans)
else:
	print(len(s))
	print(s)


import math

def findNo(x, l, k):
	l = int(l)
	k = int(k)
	freq = math.ceil(l / k)
	first = x[:k]
	i = 1
	exit = False
	while True:
		if k * (i + 1) < l:
			portion = x[k * i:k * (i + 1)]
		else:
			portion = x[k * i:] + '0' * (k * (i + 1) - l)
			exit = True
		j = 1
		lf = len(first)
		value = 0
		while True:
			f = int(first[-j])
			p = int(portion[-j])
			if f > p:
				value = 1
			elif f < p:
				value = -1
			j += 1
			if j > lf:
				break
		if value == 1:
			s = first * freq
			print(l)
			return s[:l]
		elif value == -1:
			k = 1
			while k <= lf:
				d = int(first[-k])
				if d != 9:
					first = first[:lf - k] + str(d + 1) + '0' * (k - 1)
					break
				k += 1
			s = first * freq
			print(l)
			return s[:l]
		i += 1
		if exit:
			print(l)
			return x
n = input().split()
x = input()
print(findNo(x, n[0], n[1]))


import sys
input = sys.stdin.readline
from math import ceil, floor, factorial

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
(n, k) = int_array()
s = input().strip()
s1 = s[:k]
s1 = s1 * (n // k) + s1[:n % k]
print(n)
if s1 >= s:
	print(s1)
else:
	s2 = str(int(s[:k]) + 1)
	s2 = s2 * (n // k) + s2[:n % k]
	print(s2)


import sys

class CLongBeautifulInteger:

	def solve(self):

		def check_blocks(s, k):
			for i in range(k, len(s), k):
				v = len(s[i:i + k])
				if int(s[:v]) < int(s[i:i + k]):
					return False
				if int(s[:v]) > int(s[i:i + k]):
					return True
			return True

		def add_one(s):
			return str(int(s) + 1)
		(n, k) = [int(_) for _ in input().split()]
		s = input().strip()
		base = s[:k]
		if check_blocks(s, k):
			print(n // k * k + n % k)
			print(base * (n // k) + base[:n % k])
		else:
			base1 = add_one(base)
			k1 = len(base1)
			print(k1 * (n // k1) + n % k1)
			print(base1 * (n // k1) + base1[:n % k1])
solver = CLongBeautifulInteger()
input = sys.stdin.readline
solver.solve()


import copy
(n, k) = map(int, input().split())
li = list(map(int, input()))
copyli = copy.copy(li)
for y in range(k):
	for x in range(y, n, k):
		li[x] = li[y]
print(n)
if copyli > li:
	pos = k - 1
	while li[pos] == 9 and pos > 0:
		pos = pos - 1
	ele = li[pos] + 1
	for x in range(pos, n, k):
		li[x] = ele
	for y in range(pos + 1, k):
		for x in range(y, n, k):
			li[x] = 0
for i in li:
	print(i, end='')


import sys
input = sys.stdin.readline
(N, K) = map(int, input().split())
A = [int(a) for a in list(input().rstrip())]
B = A[:K]
ok = True
for i in range(N):
	if A[i] < B[i % K]:
		ok = True
		break
	elif A[i] > B[i % K]:
		ok = False
		break
if not ok:
	ind = K - 1
	while True:
		B[ind] += 1
		if B[ind] == 10:
			B[ind] = 0
			ind -= 1
		else:
			break
ans = []
for i in range(N):
	ans.append(B[i % K])
print(N)
print(*ans, sep='')


(n, k) = map(int, input().split())
s = input()
cnt = 0
first = int(s[:k])
second = int(s[cnt * k:min(len(s), (cnt + 1) * k)]) * 10 ** max((cnt + 1) * k - len(s), 0)
while second == first and (cnt + 1) * k < len(s):
	cnt += 1
	second = int(s[cnt * k:min(len(s), (cnt + 1) * k)]) * 10 ** max((cnt + 1) * k - len(s), 0)
if first >= second:
	print(len(s))
	for i in range(len(s)):
		print(s[i % k], end='')
else:
	index = ''
	for i in range(k - 1, -1, -1):
		if int(s[i]) != 9:
			index = i
			break
	print(len(s))
	for i in range(len(s)):
		x = i % k
		if x < index:
			print(s[x], end='')
		elif index == x:
			print(str(int(s[x]) + 1), end='')
		else:
			print('0', end='')


(n, k) = map(int, input().split())
a = [int(i) for i in input()]
b = [0] * n
for i in range(k):
	b[i] = a[i]
over = True
for i in range(k, n):
	if a[i] > a[i % k]:
		over = False
		break
	elif a[i] < a[i % k]:
		break
if not over:
	b[k - 1] += 1
	i = k - 1
	while b[i] == 10:
		b[i] = 0
		b[i - 1] += 1
		i -= 1
for i in range(k, n):
	b[i] = b[i % k]
print(n)
print(''.join(map(str, b)))


import sys
(n, k) = sys.stdin.readline().strip().split()
n = int(n)
k = int(k)
x = sys.stdin.readline().strip()
X = [0] * n
for i in range(0, n):
	X[i] = int(x[i])
v = 0
w = 0
for i in range(0, n):
	if v == 0 and X[i] > X[i % k]:
		v = -1
	elif v == 0 and X[i] < X[i % k]:
		v = 1
ans = []
if v == -1:
	i = k - 1
	while X[i] == 9:
		i = i - 1
	while i < k:
		X[i] = (X[i] + 1) % 10
		i = i + 1
for i in range(0, n):
	ans.append(str(X[i % k]))
print(n)
print(''.join(ans))


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from collections import defaultdict as dd, Counter as C
(n, k) = I()
s = list(input())
t = s[:]
for i in range(n - k):
	s[i + k] = s[i]
print(n)
if s < t:
	for i in range(k - 1, -1, -1):
		if s[i] != '9':
			ok = chr(ord(s[i]) + 1)
			for j in range(i, n, k):
				s[j] = ok
			break
		else:
			for j in range(i, n, k):
				s[j] = '0'
print(''.join(s))


(n, k) = list(map(int, input().split()))
number = list(input())
pre = ''.join(number[:k])
unit = pre
cur = 0
while cur < n:
	if cur + k < n:
		temp = ''.join(number[cur:cur + k])
		if temp == pre:
			cur += k
			continue
		elif temp < pre:
			break
		elif temp > pre:
			unit = str(int(pre) + 1)
			break
	if cur + k >= n:
		temp = ''.join(number[cur:n])
		if temp == ''.join(pre[:n - cur]):
			cur += k
			continue
		elif temp < ''.join(pre[:n - cur]):
			break
		elif temp > ''.join(pre[:n - cur]):
			unit = str(int(pre) + 1)
			break
	cur += k
print(n)
res = unit * (n // k) + unit[:n % k]
print(res)


inp = input().split()
n = int(inp[0])
k = int(inp[1])
a = input()
b = ''
lower = False
for i in range(k):
	b += a[i]
for i in range(n - k):
	b += b[i % k]
for i in range(n):
	if a[i] == b[i]:
		continue
	else:
		if a[i] > b[i]:
			lower = True
		break
if lower:
	b = []
	for i in range(k):
		b += a[i]
	j = k - 1
	b[j] = chr(ord(b[j]) + 1)
	while b[j] > '9':
		b[j] = '0'
		j -= 1
		b[j] = chr(ord(b[j]) + 1)
	for i in range(n - k):
		b += b[i % k]
print(n)
for i in range(n):
	print(b[i], end='')
print()


(n, k) = map(int, input().split())
a = input()
ans = []
for i in range(k - 1):
	ans.append(a[i])
j = 0
ans.append(a[k - 1])
lenans = len(ans)
incr = False
for i in range(k, n):
	if j == lenans:
		j = 0
	if ans[j] < a[i]:
		incr = True
		break
	elif ans[j] > a[i]:
		break
	j += 1
if incr:
	increased = chr(ord(a[k - 1]) + 1)
	ans[-1] = chr(ord(a[k - 1]) + 1)
	if increased == ':':
		i = k - 1
		ans[i] = '9'
		while i >= 0 and ans[i] == '9':
			ans[i] = '0'
			i -= 1
		if i == -1:
			ans = ['1'] + ans
		else:
			ans[i] = chr(ord(ans[i]) + 1)
j = 0
for i in range(k, n):
	if j == lenans:
		j = 0
	ans.append(ans[j])
	j += 1
lenans = len(ans)
print(lenans)
print(''.join(ans))


(n, k) = map(int, input().split())
str = input()
a = []
b = []
for i in range(n):
	a.append(int(str[i]))
	b.append(int(str[i]))

def check(x):
	for i in range(n):
		if x[i] > b[i]:
			return True
		elif x[i] < b[i]:
			return False
	return True
for i in range(k):
	for j in range(i, n, k):
		a[j] = a[i]
if check(a) is False:
	a[k - 1] += 1
	for i in range(k - 1 + k, n, k):
		a[i] = a[k - 1]
for i in range(n - 1, -1, -1):
	if a[i] == 10:
		a[i - 1] += 1
		a[i] = 0
for i in range(k):
	for j in range(i, n, k):
		a[j] = a[i]
print(n)
for i in range(n):
	print(a[i], end='')


import sys
import bisect as bi
import math
from collections import defaultdict as dd
input = sys.stdin.readline

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for i in range(1):
	(n, k) = cin()
	s = sin().strip()
	fw = s[:k]
	f = 0
	mul = n // k
	mod = n % k
	for i in range(k, n - k + 1, k):
		if s[i:i + k] > fw:
			f = 1
			break
		elif s[i:i + k] < fw:
			f = 2
			break
	if f == 0:
		f = 2
		if mod != 0:
			if fw[:mod] < s[mul * k:n]:
				f = 1
	if f == 1:
		l = fw[::-1]
		revs = ''
		carry = 0
		for i in range(len(l)):
			if l[i] == '9':
				revs += '0'
			else:
				revs += str(int(l[i]) + 1)
				if i < len(l):
					revs += l[i + 1:]
				break
		revs = revs[::-1]
	elif f == 2:
		revs = fw
	ans = revs * mul + revs[0:mod]
	print(n)
	print(ans)


import sys
from array import array

def input():
	return sys.stdin.buffer.readline().decode('utf-8')
(n, k) = map(int, input().split())
a = list(map(int, input().rstrip()))
(up, low) = (n + 1, n + 1)
for i in range(k):
	if i + k >= n:
		break
	for j in range(i + k, n, k):
		if a[i] < a[j]:
			low = min(low, j)
		elif a[i] > a[j]:
			up = min(up, j)
		a[j] = a[i]
if low < up:
	for i in range(k - 1, -1, -1):
		if a[i] != 9:
			a[i::k] = [a[i] + 1] * ((n - i + k - 1) // k)
			for j in range(i + 1, k):
				a[j::k] = [0] * ((n - j + k - 1) // k)
			break
print(n)
print(*a, sep='')


def compare(a, b):
	i = 0
	if a == b:
		return True
	while True:
		if a[i] > b[i]:
			return True
		if a[i] < b[i]:
			return False
		i += 1
from math import *
(n, k) = map(int, input().split())
s = input()
s1 = (s[:k] * (n // k))[:n]
s1 += s[:n % k]
print(n)
if compare(s1, s):
	print(s1)
else:
	s2 = (str(int(s[:k]) + 1) if s[:k].count('9') != k else '9' * k) * (n // k)
	if n % k != 0:
		s2 += str(int(s[:k]) + 1)[:n % k]
	print(s2)


def find(s, k):
	start = s[:k]
	bad = 0
	for j in range(k, len(s)):
		if int(start[j % k]) < int(s[j]):
			bad = 1
			break
		elif int(s[j]) < int(start[j % k]):
			break
	if bad == 0:
		return start * (len(s) // k) + start[:len(s) % k]
	digits = [int(x) for x in start[::-1]]
	for i in range(len(digits)):
		temp = digits[i] + 1
		if temp <= 9:
			digits[i] += 1
			break
		else:
			digits[i] = 0
	ans = ''.join([str(x) for x in digits[::-1]])
	return ans * (len(s) // k) + ans[:len(s) % k]
(n, k) = list(map(int, input().strip().split()))
s = input()
print(n)
print(find(s, k))


(n, k) = map(int, input().split())
x = input()
num = x[:k]
for i in range(k, len(x), k):
	if num > x[i:i + k]:
		break
	if num < x[i:i + k]:
		num = str(int(num) + 1)
		break
print(n)
print(num * (n // k), end='')
print(num[:n % k])


import sys, math, queue, collections
MOD = 10 ** 9 + 7
(n, k) = map(int, input().split())
a = list(input())
b = a[:k]
ans = []
while len(ans) < n:
	ans += b
ans = ans[:n]
if ''.join(a) > ''.join(ans):
	for i in reversed(range(k)):
		if a[i] != '9':
			b[i] = str(int(a[i]) + 1)
			break
		else:
			b[i] = '0'
ans = []
while len(ans) < n:
	ans += b
ans = ans[:n]
print(len(ans))
print(''.join(ans))


import sys

def find_smallest_beautiful(n, k, a):
	y = fix_array(a, k)
	if stringify(y) >= stringify(a):
		return y
	y[k - 1] += 1
	for i in range(k - 1, 0, -1):
		y[i - 1] += y[i] // 10
		y[i] %= 10
	return fix_array(y, k)

def fix_array(a, k):
	f = a[:]
	for i in range(0, k):
		for j in range(i + k, len(a), k):
			f[j] = f[i]
	return f

def stringify(a):
	return ''.join((str(x) for x in a))

def solve(io):
	N = io.read_int()
	K = io.read_int()
	A = io.read_line()
	digits = [ord(c) - ord('0') for c in A]
	y = find_smallest_beautiful(N, K, digits)
	io.println(len(y))
	io.println_array(y, '')

class IO:
	in_stream = None
	out_stream = None
	raw = ''
	buf = []
	pos = 0

	def __init__(self, input_stream, output_stream):
		self.in_stream = input_stream
		self.out_stream = output_stream

	def read_to_buffer(self):
		self.raw = self.in_stream.readline().rstrip('\n')
		self.buf = self.raw.split()
		self.pos = 0

	def read_string(self):
		while self.pos == len(self.buf):
			self.read_to_buffer()
		ans = self.buf[self.pos]
		self.pos += 1
		return ans

	def read_int(self):
		return int(self.read_string())

	def read_float(self):
		return float(self.read_string())

	def read_string_array(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.read_string())
		return arr

	def read_int_array(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.read_int())
		return arr

	def read_float_array(self, N, offset=0):
		arr = [None] * offset
		for _ in range(0, N):
			arr.append(self.read_float())
		return arr

	def read_line(self):
		while self.pos == len(self.buf):
			self.read_to_buffer()
		if self.pos > 0:
			raise ValueError('Cannot call read_line in the middle of a line.')
		self.pos = len(self.buf)
		return self.raw

	def print(self, *args):
		self.out_stream.write(' '.join([str(x) for x in args]))

	def println(self, *args):
		self.print(*args)
		self.print('\n')

	def println_array(self, arr, sep=' '):
		self.println(sep.join((str(x) for x in arr)))

	def flush_output(self):
		self.out_stream.flush()
pythonIO = IO(sys.stdin, sys.stdout)
solve(pythonIO)
pythonIO.flush_output()


ok = [int(x) for x in input().split()]
x = ok[0]
y = ok[1]
n = input()
a = n[:y]
pos = True
for i in range(x - y):
	if n[i + y] > n[i % y]:
		pos = False
		break
	elif n[i + y] < n[i % y]:
		pos = True
		break
stri = ''
if pos == False:
	lastNine = -1
	for i in range(y):
		if a[i] != '9':
			lastNine = i
	if lastNine == -1:
		a = '1'
		for i in range(y - 1):
			a = a + '0'
		x += 1
	else:
		a = a[:lastNine] + str(1 + int(a[lastNine]))
		for i in range(y - lastNine - 1):
			a = a + '0'
for i in range(x // y):
	stri = stri + a
stri = stri + a[:x % y]
print(x)
print(stri)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	(n, k) = sep()
	s = list(inp())
	for i in range(n):
		s[i] = int(s[i])
	new = []
	for i in range(k):
		new.append(s[i])
	for i in range(k, n):
		new.append(s[i % k])
	if int(''.join((str(s[i]) for i in range(n)))) <= int(''.join((str(new[i]) for i in range(n)))):
		print(n)
		print(''.join((str(new[i]) for i in range(n))))
		return
	ind = k - 1
	while s[ind] == 9:
		s[ind] = 0
		ind -= 1
	s[ind] += 1
	ans = []
	for i in range(k):
		ans.append(s[i])
	for i in range(k, n):
		ans.append(ans[i % k])
	print(n)
	print(''.join((str(ans[i]) for i in range(n))))
testcase(1)


(n, k) = map(int, input().split())
s = input()
a = ''
for i in range(n):
	a += s[i % k]
if a >= s:
	print(n)
	print(a)
else:
	s = list(s[:k])
	for i in range(k - 1, -1, -1):
		if s[i] == '9':
			s[i] = '0'
		else:
			s[i] = str(int(s[i]) + 1)
			break
	print(n)
	for i in range(n):
		print(s[i % k], end='')


(a, b) = map(int, input().split())
z = input()
s = z[:b] * (a // b) + z[:a % b]
print(a)
if s >= z:
	print(s)
else:
	s = str(int(z[:b]) + 1)
	s = s * (a // b) + s[:a % b]
	print(s)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	(n, k) = mi()
	s = si()
	t = ''
	for i in range(n):
		t += s[i % k]
	if t >= s:
		print(n)
		print(t)
		exit()
	s = list(s)
	for i in range(k - 1, -1, -1):
		if s[i] == '9':
			s[i] = '0'
		else:
			s[i] = str(int(s[i]) + 1)
			break
	t = ''
	for i in range(n):
		t += s[i % k]
	print(n)
	print(t)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import Counter as CO
from collections import OrderedDict as OD
import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
arr = list(map(int, input().strip()))
ind = -1
flag = 0
for i in range(k):
	for j in range(i, n, k):
		if arr[j] != arr[i]:
			flag = 1
if flag == 0:
	print(n)
	arr = [str(i) for i in arr]
	print(''.join(arr))
else:
	brr = [0] * n
	for i in range(k):
		for j in range(i, n, k):
			brr[j] = arr[i]
	if brr >= arr:
		print(n)
		brr = [str(i) for i in brr]
		print(''.join(brr))
	else:
		for i in range(k - 1, -1, -1):
			if arr[i] != 9:
				ind = i
				break
		if ind == -1:
			print(n + 1)
			arr = [0] * (n + 1)
			for i in range(0, n + 1, k):
				arr[i] = 1
			arr = [str(i) for i in arr]
			print(''.join(arr))
		else:
			print(n)
			arr[ind] += 1
			for i in range(k):
				if i > ind:
					arr[i] = 0
				for j in range(i, n, k):
					arr[j] = arr[i]
			arr = [str(i) for i in arr]
			print(''.join(arr))


import math
(n, k) = list(map(int, input().split()))
a = input()
o = math.ceil(n / k)
mc = -1
u = 0
for j in range(1, o):
	for i in range(k):
		if i + k * j < n:
			if a[i + k * j] != a[i]:
				if int(a[i + k * j]) > int(a[i]):
					mc = 1
				else:
					mc = 0
				u = 1
				break
	if u == 1:
		break
print(n)
if mc == -1:
	print(a)
elif mc == 0:
	r = list(a[:k]) * o
	s = ''.join(r)
	print(s[:n])
else:
	gn = str(int(a[:k]) + 1)
	r = list(gn[:k]) * o
	s = ''.join(r)
	print(s[:n])


from collections import defaultdict as dc
import sys
import math
mod = 10 ** 9 + 7

def bs(a, x):
	i = bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return len(a)

def bs(a, b):
	l = a
	r = b + 1
	x = b
	ans = 0
	while l < r:
		mid = (l + r) // 2
		if x | mid > ans:
			ans = x | mid
			l = mid + 1
		else:
			r = mid
	return ans

def digit(n):
	a = []
	while n > 0:
		a.append(n % 10)
		n = n // 10
	return a

def inp():
	p = int(input())
	return p

def line():
	p = list(map(int, input().split()))
	return p

def ans(n, k, a):
	p = list(a)
	kl = 1
	for i in range(n - k):
		if a[i] != a[i + k]:
			kl = 0
		p[i + k] = p[i]
	p = ''.join(p)
	if int(p) > int(a):
		return (kl, 1, p)
	else:
		return (kl, 0, p)
(n, k) = line()
a = str(input())
(kl, y, z) = ans(n, k, a)
if kl:
	print(len(a))
	print(a)
elif y == 1:
	print(len(z))
	print(z)
else:
	p = a[:k]
	p = str(int(p) + 1)
	l = n // k
	o = n % k
	ans = p * l + p[:o]
	print(len(ans))
	print(ans)


(n, k) = list(map(int, input().strip().split()))
xc = input()
x = xc[:k]
y = str(int(x) + 1)
op1 = (x * (n // k + 1))[:n]
print(n)
if op1 >= xc:
	print(op1)
else:
	op2 = (y * (n // k + 1))[:n]
	print(op2)


(n, k) = map(int, input().split())
c = input()
x = list(c)
for i in range(k, n):
	x[i] = x[i - k]
while ''.join(x) < c:
	i = k - 1
	while i >= 0:
		if x[i] != '9':
			break
		i -= 1
	if i != -1:
		x[i] = str(int(x[i]) + 1)
		i += 1
		while i <= k and x[i] == '9':
			x[i] = '0'
			i += 1
for i in range(k, n):
	x[i] = x[i - k]
print(len(x))
print(''.join(x))


import sys
[n, k] = [int(i) for i in sys.stdin.readline().split()]
a = sys.stdin.readline().strip()
arr = []
for p in range(n):
	arr.append(int(a[p]))
done = 1
for g in range(n):
	if arr[g] != arr[g % k]:
		done = 0
		break
if done == 1:
	print(n)
	print(a)
else:
	s_to_l = n
	l_to_s = n
	for x in range(n):
		if arr[x] > arr[x % k]:
			if l_to_s == n:
				l_to_s = x
		elif arr[x] < arr[x % k]:
			if s_to_l == n:
				s_to_l = x
		arr[x] = arr[x % k]
	if s_to_l < l_to_s:
		print(n)
		for h in range(n):
			print(arr[h], end='')
		print()
	else:
		for x in range(k - 1, -1, -1):
			if arr[x] != 9:
				arr[x] += 1
				for y in range(x + 1, k):
					arr[y] = 0
				for g in range(n):
					arr[g] = arr[g % k]
				break
		print(n)
		for h in range(n):
			print(arr[h], end='')
		print()


def main():
	(n, k) = list(map(int, input().split()))
	s = input()
	temp = s[:k]
	temp = temp * (n // k)
	i = 0
	while len(temp) < n:
		temp += s[i]
		i += 1
	if int(temp) >= int(s):
		print(len(temp))
		print(temp)
	else:
		x = int(s[:k])
		x += 1
		x = str(x)
		x = x * (n // k)
		i = 0
		while len(x) < n:
			x += x[i]
			i += 1
		print(len(x))
		print(x)
main()


def notBeautifulIdx(arr, k):
	m = len(arr)
	for i in range(m - k):
		if arr[i] != arr[i + k]:
			return i + k
	return -1
(n, k) = map(int, input().split())
arr = list(map(int, list(input())))
idx = notBeautifulIdx(arr, k)
if idx == -1:
	print(n)
	print(''.join(map(str, arr)))
else:
	c = arr[:k]
	if arr[idx] > arr[idx - k]:
		d = int(''.join(map(str, c[:k]))) + 1
		c = list(map(int, list(str(d))))
	c = c[:k]
	c = c * (n // k + 10)
	c = c[:n]
	print(n)
	print(''.join(map(str, c)))


def findSum(str1, str2):
	if len(str1) > len(str2):
		temp = str1
		str1 = str2
		str2 = temp
	str3 = ''
	n1 = len(str1)
	n2 = len(str2)
	diff = n2 - n1
	carry = 0
	for i in range(n1 - 1, -1, -1):
		sum = ord(str1[i]) - ord('0') + int(ord(str2[i + diff]) - ord('0')) + carry
		str3 = str3 + str(sum % 10)
		carry = sum // 10
	for i in range(n2 - n1 - 1, -1, -1):
		sum = ord(str2[i]) - ord('0') + carry
		str3 = str3 + str(sum % 10)
		carry = sum // 10
	if carry:
		str3 + str(carry + '0')
	str3 = str3[::-1]
	return str3
(n, k) = [int(x) for x in input().split()]
s = input()
ln = len(s)
uptok = ''
for i in range(0, k):
	uptok = uptok + s[i]
cnt = ln // k
st = ''
for i in range(0, cnt):
	st = st + uptok
for i in range(0, ln % k):
	st = st + s[i]
print(ln)
if st >= s:
	print(st)
else:
	str1 = uptok
	str2 = '1'
	uptok2 = findSum(str1, str2)
	cnt = ln // k
	st2 = ''
	for i in range(0, cnt):
		st2 = st2 + uptok2
	for i in range(0, ln % k):
		st2 = st2 + uptok2[i]
	print(st2)


(_, k) = input().split()
k = int(k)
n = list(input())
lox = ''.join(n[:k])

def plusone(lox):
	lox = list(lox)
	i = -1
	lox = ['0'] + lox
	while lox[i] == '9':
		lox[i] = '0'
		i -= 1
	lox[i] = str(int(lox[i]) + 1)
	if lox[0] == '0':
		lox = lox[1:]
	return ''.join(lox)

def less(a, b):
	for (i, j) in zip(a, b):
		if i != j:
			break
	else:
		return 0
	return i < j
gen = lambda lox: len(n) // len(lox) * lox + lox[:len(n) % len(lox)]
lox = n[:k]
if less(gen(lox), n):
	lox = plusone(lox)

def ceildiv(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1
n = len(n) // len(lox) * lox + lox[:len(n) % len(lox)]
print(len(n))
print(''.join(n))


import sys
import math
input = sys.stdin.readline
(n, m) = list(map(int, input().split()))
a = input().rstrip()
sub = a[:m]
if sub.count('9') == len(sub):
	print(len(a))
	print('9' * len(a))
else:
	p = (sub * math.ceil(n / m))[:len(a)]
	if int(p) >= int(a):
		print(len(a))
		print(p)
	else:
		sub = str(int(sub) + 1)
		p = (sub * math.ceil(n / m))[:len(a)]
		print(len(a))
		print(p)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
a = input().rstrip()
s = a[:k] * (n // k + 1)
s = s[:n]
if s >= a:
	print(len(s))
	print(s)
else:
	s2 = list(a[:k])
	for i in range(k):
		s2[i] = int(s2[i])
	s2[-1] += 1
	for i in range(k)[::-1]:
		if s2[i] >= 10:
			s2[i] -= 10
			s2[i - 1] += 1
	for i in range(k):
		s2[i] = str(s2[i])
	s2 = ''.join(s2)
	ans = s2 * (n // k + 1)
	ans = ans[:n]
	print(len(ans))
	print(ans)


(n, k) = input().split()
n = int(n)
k = int(k)
a = input()
b = ''
for i in range(n):
	b += a[i % k]
if b < a:
	c = ''
	b = ''
	for i in range(k):
		c += a[i]
	d = str(int(c) + 1)
	for i in range(n):
		b += d[i % k]
print(len(b))
print(b)


import math
(x, k) = map(int, input().split())
s = input()
s1 = s[0:k]
final = s1 * math.ceil(x / k)
final = final[0:x]
if int(final) < int(s):
	final = ''
	s1 = int(s1)
	s1 = s1 + 1
	s1 = str(s1)
	final = final + s1 * math.ceil(x / k)
	final = final[0:x]
print(len(final))
print(final)


import sys
(n, k) = list(map(int, sys.stdin.readline().strip().split()))
x = sys.stdin.readline().strip()
xc = x
x = x[:k]
op1 = (x * (n // k + 1))[:n]
print(n)
if op1 >= xc:
	print(op1)
else:
	y = str(int(x) + 1)
	op2 = (y * (n // k + 1))[:n]
	print(op2)


(n, k) = map(int, input().split())
x = input()
if n % k != 0:
	x += '0' * (k - n % k)
d = len(x) // k
arr = [x[i * k:i * k + k] for i in range(d)]
first = arr[0]
cand = first * d
if cand >= x:
	print(n)
	print(cand[:n])
else:
	cand_len = len(first)
	first = str(int(first) + 1)
	print(n)
	print((first * d)[:n])


(n, k) = list(map(int, input().split()))
s = input()
num = s[:k] * (n // k) + s[:n % k]
print(n)
if s <= num:
	print(num)
else:
	v = str(int(s[:k]) + 1)
	num = v * (n // k) + v[:n % k]
	print(num)


def comp(a, b):
	for i in range(len(a)):
		if a[i] == b[i]:
			continue
		return a[i] < b[i]
	return 1
(n, k) = map(int, input().split())
a = [int(i) for i in input()]
period = a[:k]
ans = []
s = period * (n // k) + period[:n % k]
if comp(a, s):
	ans = s.copy()
	print(len(ans))
	print(''.join([str(i) for i in ans]))
	exit()
for i in range(k - 1, -1, -1):
	if period[i] == 9:
		period[i] = 0
		continue
	period[i] += 1
	s = period * (n // k) + period[:n % k]
	if ans == []:
		ans = s.copy()
		break
	period[i] = 0
print(len(ans))
print(''.join([str(i) for i in ans]))


(n, k) = map(int, input().split())
s = input()
s = [i for i in s]
loc = n + 5
f = 0
for i in range(k):
	for j in range(i + k, n, k):
		if int(s[j]) > int(s[i]) and loc > j:
			f = 1
			loc = j
		elif int(s[j]) < int(s[i]) and loc > j:
			f = 0
			loc = j
		s[j] = s[i]
if f == 1:
	j = k - 1
	while s[j] == '9':
		j -= 1
	tmp = int(s[j]) + 1
	tmp = str(tmp)
	for i in range(j, n, k):
		s[i] = tmp
	j += 1
	for i in range(j, k):
		for t in range(i, n, k):
			s[t] = '0'
print(len(s))
for i in s:
	print(i, end='')


from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def main():
	(n, k) = mi()
	s = si()
	val = int(s)
	s1 = s[:k]
	s1 = s1 * ceil(n / k)
	s1 = s1[:n]
	print(n)
	if int(s1) >= val:
		print(s1)
	else:
		s1 = list(s1)
		for i in range(k - 1, -1, -1):
			if s1[i] == '9':
				s1[i] = '0'
			else:
				s1[i] = chr(ord(s1[i]) + 1)
				break
		s1 = s1[:k] * ceil(n / k)
		s1 = s1[:n]
		s1 = ''.join(s1)
		print(s1)
main()


from copy import deepcopy
from math import ceil
(n, k) = list(map(int, input().split()))
a = list(input())
flag = 0
for i in range(1, int(ceil(n / k))):
	for j in range(0, k):
		if j + i * k >= n:
			continue
		if a[j + i * k] < a[j]:
			flag = -1
			break
		if a[j + i * k] > a[j]:
			flag = 1
			break
	if flag != 0:
		break
if flag == 0:
	print(len(a))
	print(''.join(a))
elif flag == -1:
	for i in range(k, n):
		a[i] = a[i - k]
	print(len(a))
	print(''.join(a))
else:
	b = deepcopy(a)
	for i in range(k, n):
		b[i] = b[i - k]
	if b > a:
		print(len(a))
		print(''.join(b))
	else:
		a[0:k] = str(int(''.join(a[0:k])) + 1)
		for i in range(k, n):
			a[i] = a[i - k]
		print(len(a))
		print(''.join(a))


def repeat(s, n):
	k = len(s)
	r = []
	for i in range(n):
		r.append(s[i % k])
	return ''.join(r)

def solve(n, k, s):
	t = repeat(s[:k], n)
	if t >= s:
		return t
	x = str(int(s[:k]) + 1)
	assert len(x) == k
	return repeat(x, n)
(n, k) = map(int, input().split())
s = input()
res = solve(n, k, s)
print(len(res))
print(res)


import sys
import math
from collections import defaultdict, Counter
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(1):
	(n, k) = map(int, input().split())
	a = input()
	old = int(a)
	b = a[:k] * (n // k) + a[:n % k]
	if int(b) < old:
		k1 = k - 1
		while a[k1] == '9':
			k1 -= 1
		cur = str(int(a[k1]) + 1)
		a1 = a[:k1] + cur + '0' * (k - 1 - k1)
		b = a1[:k] * (n // k) + a1[:n % k]
	print(n)
	print(b)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
(n, k) = list(map(int, input().split()))
a = list(map(int, input()))
b = a[:k]
c = [b[i % k] for i in range(n)]
if tuple(a) > tuple(c):
	d = int(''.join(map(str, b)))
	d += 1
	b = list(map(int, str(d)))
	c = [b[i % k] for i in range(n)]
print(len(c))
print(''.join(map(str, c)))


from __future__ import division, print_function
import sys
import os
from io import BytesIO, IOBase
from math import *
import os
import sys
from io import BytesIO, IOBase
from math import *
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	(n, k) = sep()
	s = list(inp())
	for i in range(n):
		s[i] = int(s[i])
	new = []
	for i in range(k):
		new.append(s[i])
	for i in range(k, n):
		new.append(s[i % k])
	if int(''.join((str(s[i]) for i in range(n)))) <= int(''.join((str(new[i]) for i in range(n)))):
		print(n)
		print(''.join((str(new[i]) for i in range(n))))
		return
	ind = k - 1
	while s[ind] == 9:
		s[ind] = 0
		ind -= 1
	s[ind] += 1
	ans = []
	for i in range(k):
		ans.append(s[i])
	for i in range(k, n):
		ans.append(ans[i % k])
	print(n)
	print(''.join((str(ans[i]) for i in range(n))))
testcase(1)


(n, k) = map(int, input().split())
a = input()
osn = a[0:k]
j = k
if osn * (n // k) + osn[0:n % k] == a:
	print(len(a))
	print(a)
elif osn * (n // k) + osn[0:n % k] > a:
	print(len(a))
	print(osn * (n // k) + osn[0:n % k])
else:
	osn = str(int(osn) + 1)
	if len(osn) > k:
		print(len(a) + 1)
		osn = '1' + '0' * len(a)
		print(osn * (n // k) + osn[0:n % k])
	else:
		print(len(a))
		print(osn * (n // k) + osn[0:n % k])


(n, k) = map(int, input().split())
A = input()
x = int(A)
if k <= n // 2:
	initial = A[:k]
	ans = initial * (n // k) + initial[:n % k]
	if int(ans) >= x:
		print(len(ans))
		print(ans)
	else:
		initial = int(initial)
		initial += 1
		initial = str(initial)
		ans = initial * (n // k) + initial[:n % k]
		print(len(ans))
		print(ans)
else:
	k = n - k
	initial = A[:k]
	p = A[k:n - k]
	ans = initial + p + initial
	while int(ans) < x:
		p = int(p) + 1
		ans = initial + str(p) + initial
	if len(ans) > n:
		initial = int(initial) + 1
		initial = str(initial)
		ans = initial + '0' * (n - k - k) + initial
		print(len(ans))
		print(ans)
	else:
		print(len(ans))
		print(ans)


(n, m) = map(int, input().split())
s = input()
s1 = s[:m]
s2 = ''
for i in range(n):
	s2 += s1[i % m]
print(n)
if s2 >= s:
	print(s2)
else:
	j = m - 1
	while s1[j] == '9':
		j -= 1
	s1 = s1[:j] + chr(ord(s1[j]) + 1)
	s1 += '0' * (m - len(s1))
	s2 = ''
	for i in range(n):
		s2 += s1[i % m]
	print(s2)


def beautiful(a, n, k):
	for i in range(n):
		if a[i] < a[i % k]:
			return -1
		elif a[i] > a[i % k]:
			return 1
	return 0
(N, K) = map(int, input().split())
A = input()
print(N)
res = beautiful(A, N, K)
while res != 0:
	if res == -1:
		A = (A[0:K] * (N // K + 1))[0:N]
	elif res == 1:
		x = str(int(A[0:K]) + 1)
		A = (x * (N // K + 1))[0:N]
	res = beautiful(A, N, K)
print(A)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')
from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	(n, k) = RL()
	a = input()
	na = a[:k] * (n // k) + a[:n % k]
	print(n)
	if a <= na:
		print(na)
	else:
		res = str(int(a[:k]) + 1)
		nres = res[:k] * (n // k) + res[:n % k]
		print(nres)
main()


from sys import stdin
input = lambda : stdin.readline().strip()
lin = lambda : list(map(int, input().split()))
iin = lambda : int(input())
main = lambda : map(int, input().split())
from math import ceil, sqrt, factorial, log
from collections import deque
from bisect import bisect_left
mod = 998244353
mod = 1000000007

def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while a % b != 0:
		(a, b) = (b, a % b)
	return b

def moduloinverse(a):
	return pow(a, mod - 2, mod)

def solve(we):
	(n, k) = map(int, input().split())
	s = list(input())
	z = s.copy()
	for i in range(k, n):
		z[i] = z[i - k]
	if z >= s:
		print(n)
		print(''.join(z))
	else:
		for i in range(k - 1, -1, -1):
			if z[i] != '9':
				for i in range(i, n, k):
					z[i] = str(int(z[i]) + 1)
				break
			else:
				for i in range(i, n, k):
					z[i] = '0'
		print(n)
		print(''.join(z))
qwe = 1
for _ in range(qwe):
	solve(_ + 1)


(n, k) = [int(x) for x in input().split()]
t = list(input())
s = int(''.join(t))
for i in range(k):
	for j in range(i, n, k):
		t[j] = t[i]
if int(''.join(t)) < s:
	mark = k - 1
	idx = []
	while t[mark] == '9':
		idx.append(mark)
		mark -= 1
		if mark == 0:
			break
	for j in range(mark, n, k):
		t[j] = chr(ord(t[j]) + 1)
	for i in idx:
		for j in range(i, n, k):
			t[j] = '0'
print(len(t))
print(''.join(t))


(n, k) = map(int, input().split())
s = input()
s1 = s[:k]
s1 = s1 * (n // k) + s1[:n % k]
print(n)
if s1 >= s:
	print(s1)
else:
	s2 = str(int(s[:k]) + 1)
	s2 = s2 * (n // k) + s2[:n % k]
	print(s2)


(n, k) = map(int, input().split())
s = input()
dx = s[:k]
while len(dx) < n:
	dx += dx
dx = dx[:n]
if dx >= s:
	print(n)
	print(dx)
	quit()
fini = -1
for i in range(k):
	if s[i] != '9':
		fini = i
if fini != -1:
	s1 = [int(q) for q in s]
	s1[fini] += 1
	for i in range(fini + 1, k):
		s1[i] = 0
	s1 = s1[:k]
	ans = ''.join((str(q) for q in s1))
	print(n)
	while len(ans) < n:
		ans += ans
	print(ans[:n])
else:
	print(n)
	print('9' * n)


def f():
	(n, k) = [int(s) for s in input().split()]
	a = [int(s) for s in input()]
	tag = [a[i] for i in range(k)]
	must = -1
	for i in range(k, n):
		if a[i] != tag[i % k]:
			must = i
			break
	if must == -1:
		print(n)
		print(''.join((str(num) for num in a)))
		return
	if a[must] > tag[must % k]:
		for i in range(k - 1, -1, -1):
			if tag[i] != 9:
				tag[i] = tag[i] + 1
				for j in range(i + 1, k):
					tag[j] = 0
				break
	b = [tag[i % k] for i in range(n)]
	print(n)
	print(''.join((str(num) for num in b)))
f()


(n, k) = map(int, input().split())
s = input()
t = s[:k]
fin = t * (n // k) + t[:n % k]
if fin >= s:
	print(len(fin))
	print(fin)
else:
	t = str(int(t) + 1)
	fin = t * (n // k) + t[:n % k]
	print(len(fin))
	print(fin)


from typing import List

def expand(rep: List[int], digits: int) -> List[int]:
	pattern = []
	pattern.extend(rep)
	k = len(rep)
	while len(pattern) < digits:
		pattern.append(pattern[-k])
	return pattern

def inc(pattern: List[int]) -> None:
	pattern[-1] += 1
	d = 1
	while pattern[-d] == 10:
		pattern[-d] = 0
		pattern[-d - 1] += 1
		d += 1
(n, k) = map(int, input().split())
y = input().strip('\n')
number = []
for d in y:
	number.append(int(d))
pat = number[:min(k, len(number))]
while expand(pat, len(number)) < number:
	inc(pat)
ans = ''
for d in expand(pat, len(number)):
	ans += str(d)
print(len(ans))
print(ans)


(n, k) = map(int, input().split())
ss = [i for i in input()]
ok = ''.join(ss)
for i in range(k, n):
	ss[i] = ss[i - k]
if ''.join(ss) >= ok:
	print(n)
	print(''.join(ss))
else:
	carry = 0
	for i in range(k - 1, -1, -1):
		if int(ss[i]) < 9:
			ss[i] = str(int(ss[i]) + (1 or carry))
			for ii in range(k, n):
				ss[ii] = ss[ii - k]
			if ''.join(ss) >= ok:
				print(n)
				print(''.join(ss))
				exit(0)
			carry = 0
		else:
			ss[i] = '0'
			for ii in range(k, n):
				ss[ii] = ss[ii - k]
			carry = 1


(n, k) = [int(x) for x in input().split()]
x = str(input())

def repeat_to_length(s, wanted):
	return (s * (wanted // len(s) + 1))[:wanted]
upper = x[:k]
y = upper + repeat_to_length(str(upper), n - k)
if y >= x:
	print(len(y), y, sep='\n')
else:
	upper = str(int(upper) + 1)
	y = upper + repeat_to_length(str(upper), n - k)
	print(len(y), y, sep='\n')


(n, k) = map(int, input().split())
x = list(map(int, input()))
y = [list() for i in range(k)]
for (i, a) in enumerate(x):
	y[i % k].append(a)
for a in y:
	for i in range(1, len(a)):
		a[i] = a[0]
y_flat = [a[i] for i in range(len(y[0])) for a in y if len(a) > i]
if y_flat < x:
	for a in reversed(y):
		if a[0] == 9:
			a[:] = [0] * len(a)
		else:
			a[:] = [a[0] + 1] * len(a)
			break
y_flat = [a[i] for i in range(len(y[0])) for a in y if len(a) > i]
print(len(y_flat))
print(*y_flat, sep='')


(n, k) = map(int, input().split())
print(n)
l = input()
s = l[:k]
x = n // k
y = n - k * x
a = l[:y]
if s * x + a < l:
	s = int(s)
	s += 1
	s = str(s)
a = s[:y]
print(s * x + a)


(n, k) = map(int, input().split())
a = []
s = input()
for j in s:
	a.append(int(j))
b = a[:k]
j = 0
f = 0
while j < n:
	if a[j] > b[j % k]:
		f = 1
		break
	elif a[j] < b[j % k]:
		break
	else:
		pass
	j += 1
if f == 1:
	j = k - 1
	while j >= 0:
		if b[j] == 9:
			b[j] = 0
		else:
			b[j] += 1
			break
		j += -1
d = []
for j in range(n):
	d.append(str(b[j % k]))
	j += 1
print(len(d))
print(''.join(d))


(n, k) = map(int, input().split())
a = input()
s1 = str(int(a[:k]) + 1)
b = a[:k] * (n // k) + a[:n % k]
if b < a:
	b = s1 * (n // k) + s1[:n % k]
print(n)
print(b)


(n, k) = map(int, input().split())
s = list(input())
t = s[:k]
print(n)
for i in range(k - 1, -1, -1):
	if t[i] != '9':
		t[i] = str(int(t[i]) + 1)
		break
	else:
		t[i] = '0'
c = (s[:k] * ((n - 1) // k + 1))[:n]
d = (t * ((n - 1) // k + 1))[:n]
a = 0
for i in range(n):
	if int(c[i]) < int(s[i]):
		a = 1
		break
	if int(c[i]) > int(s[i]):
		a = 0
		break
r = ''
if a:
	for i in d:
		r += i
	print(r)
else:
	for i in c:
		r += i
	print(r)


(n, k) = map(int, input().split())
no = input()
ans = list(no)

def finish():
	print(len(ans))
	print(''.join(ans))
	quit()
pos = -1
for i in range(n - k):
	if no[i] != no[i + k]:
		pos = i
		break
if pos == -1:
	finish()
if no[pos] > no[pos + k]:
	for i in range(pos, n - k):
		ans[i + k] = ans[i]
	finish()
new_pos = k - 1
while new_pos >= 0 and no[new_pos] == '9':
	new_pos -= 1
if new_pos == -1:
	ans = ['1'] + ['0'] * n
	ans[k] = '1'
else:
	ans[new_pos] = str(int(ans[new_pos]) + 1)
	for i in range(new_pos + 1, k):
		ans[i] = '0'
	for i in range(n - k):
		ans[i + k] = ans[i]
finish()


s = list(map(int, input().split()))
(x, k) = (s[0], s[1])
s = input()
m = x - k
print(x)
if k < m:
	abc = s[0:k]
	p = m // k + 1
	abc = abc * p
	abc = abc[0:m]
	abd = abc[::-1]
	abc = abc + abd[0:k][::-1]
	if int(abc) >= int(s):
		print(abc)
	else:
		abc = str(int(s[0:k]) + 1)
		p = m // k + 1
		abc = abc * p
		abc = abc[0:m]
		abd = abc[::-1]
		abc = abc + abd[0:k][::-1]
		print(abc)
else:
	abc = s[0:m] + s[m:k] + s[0:m]
	if int(abc) >= int(s):
		print(abc)
	elif k > m and s[m:k] != '9' * (k - m):
		abc = s[0:m] + str(int(s[m:k]) + 1) + s[0:m]
		print(abc)
	else:
		abc = str(int(s[0:m]) + 1)
		abc = abc + '0' * max(0, k - m) + abc
		print(abc)


import sys
input = sys.stdin.readline
from math import *
(n, k) = map(int, input().split())
a = list(input().rstrip())
p = int(''.join(a))
f = 0
fl = n
for j in range(k):
	for i in range(j, n, k):
		a[i] = a[j]
if p <= int(''.join(a)):
	print(len(a))
	print(''.join(a))
else:
	f = 0
	for j in range(k - 1, -1, -1):
		if a[j] < '9':
			h = int(a[j]) + 1
			h = str(h)
			f = 1
		else:
			h = '0'
		for i in range(j, n, k):
			a[i] = h
		if f == 1:
			break
	print(len(a))
	print(''.join(a))


(n, k) = map(int, input().split())
a = [int(i) for i in input().strip()]
good = True
for i in range(n):
	if a[i] != a[i % k]:
		good = False
		break
if good:
	print(n)
	print(''.join(map(str, a)))
else:
	portion = a[:k].copy()
	if portion * (n // k) + portion[:n % k] >= a:
		print(n)
		print(''.join(map(str, portion * (n // k) + portion[:n % k])))
	else:
		for i in range(k - 1, -1, -1):
			portion[i] = (portion[i] + 1) % 10
			if portion[i]:
				break
		portion = portion * (n // k) + portion[:n % k]
		print(len(portion))
		print(''.join(map(str, portion)))


(n, k) = map(int, input().split())
a = list(map(int, input()))
b = a[:]
for i in range(k):
	for j in range(i + k, n, k):
		b[j] = b[i]
if a > b:
	for i in range(k - 1, -1, -1):
		for m in range(b[i] + 1, 10):
			for j in range(i, n, k):
				b[j] = m
			if a <= b:
				break
		else:
			for j in range(i, n, k):
				b[j] = 0
			continue
		break
print(len(b))
print(*b, sep='')


(n, k) = [int(i) for i in input().split()]
a = input()
print(n)
target = a[:k] * (n // k) + a[:n % k]
if int(target) < int(a):
	prefix = str(int(a[:k]) + 1)
	target = prefix[:k] * (n // k) + prefix[:n % k]
print(target)


(n, k) = map(int, input().split())
s = input()
curp = s[:k]
cur = str(curp * (n // k + 1))[:n]
if int(cur) >= int(s):
	print(n)
	print(cur)
	exit(0)
curp = str(int(curp) + 1)
c = 10 ** k
if int(curp) < c:
	cur = str(curp * (n // k + 1))[:n]
	print(n)
	print(cur)
	exit(0)
else:
	cur = str(str(c) * (n // k + 1))[:n + 1]
	print(n + 1)
	print(cur)
	exit(0)


from math import floor, ceil

def bautiful(ais, k):
	m = len(ais)
	for i in range(0, m - k):
		if ais[i] != ais[i + k]:
			return False
	return True

def new_number(ais, prefix):
	first_part = str(prefix) * floor(len(ais) / len(prefix))
	len_diff = len(ais) - len(first_part)
	return first_part + (prefix[:len_diff] if len_diff > 0 else '')

def main():
	(n, k) = [int(x) for x in input().split(' ')]
	ais = input()
	if bautiful(ais, k):
		print(len(ais))
		print(ais)
		return 0
	k_prefix = ais[:k]
	first_test = new_number(ais, k_prefix)
	if int(ais) <= int(first_test) and bautiful(first_test, k):
		print(len(first_test))
		print(first_test)
	else:
		second_test = new_number(ais, str(int(k_prefix) + 1))
		print(len(second_test))
		print(second_test)
	return 0
main()


import math as mt
(n, k) = map(int, input().split())
s = input()
temp = list(s)
te = s[:k]
flag = 1
for i in range(k, n):
	if s[i % k] != s[i]:
		flag = 0
		temp[i] = s[i % k]
if not flag:
	if ''.join(temp) > s:
		print(n)
		print(''.join(temp))
	else:
		te = str(int(te) + 1)
		for i in range(n):
			temp[i] = te[i % k]
		print(n)
		print(''.join(temp))
else:
	print(n)
	print(s)


(n, m) = map(int, input().split())
s = list(input())

def check(b, s):
	for i in range(n - k):
		b[i + k] = b[i]
	s = ''.join(s)
	b = ''.join(b)
	if b >= s:
		return True
	else:
		return False
k = m
b = s.copy()
if check(s, b):
	print(n)
	print(''.join(s))
else:
	if s[k - 1] == '9':
		s[k - 1] = '0'
		for i in range(k - 2, -1, -1):
			if s[i] == '9':
				s[i] = '0'
			else:
				s[i] = str(int(s[i]) + 1)
				break
	else:
		s[k - 1] = str(int(s[k - 1]) + 1)
	print(n)
	for i in range(n - k):
		s[i + k] = s[i]
	print(''.join(s))


import os, sys, math
import collections
if os.path.exists('testing'):
	name = os.path.basename(__file__)
	if name.endswith('.py'):
		name = name[:-3]
	src = open(name + '.txt', encoding='utf8')
	input = src.readline

def solve():
	for x in range(k, len(s), 1):
		orig_index = x % k
		if s[x] < s[orig_index]:
			return (s[:k] * (len(s) // k + 1))[:len(s)]
		if s[x] > s[orig_index]:
			tmp = [q for q in s[:k]]
			for x in range(k - 1, -1, -1):
				if tmp[x] != '9':
					tmp[x] = chr(ord(tmp[x]) + 1)
					break
				else:
					tmp[x] = '0'
			else:
				assert False
			v = ''.join(tmp)
			return (v * (len(s) // k + 1))[:len(s)]
	return s

def integers():
	return map(int, input().strip().split())

def array_of_integers(q):
	return [tuple(map(int, input().strip().split())) for _ in range(q)]
(n, k) = integers()
s = input().strip()
res = solve()
print(len(res))
print(res)


def oneLineArrayPrint(arr):
	print(''.join([str(x) for x in arr]))
(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input()]
ans = [0 for _ in range(k)]
for i in range(k):
	ans[i] = a[i]
increaseNeeded = False
for i in range(k, n):
	if ans[i % k] < a[i]:
		increaseNeeded = True
	if ans[i % k] > a[i]:
		break
if increaseNeeded:
	i = k - 1
	inc = 1
	while True:
		ans[i] += inc
		if ans[i] >= 10:
			ans[i] -= 10
			i -= 1
			inc = 1
		else:
			break
while len(ans) < n:
	ans.append(ans[len(ans) - k])
print(n)
oneLineArrayPrint(ans)


(n, k) = map(int, input().split())
num = input()
subs = num[:k]
min_repeat = (subs * (n // k + 1))[:n]
if min_repeat >= num:
	print(len(min_repeat))
	print(min_repeat)
	quit()
subs = str(int(subs) + 1)
min_repeat = (subs * (n // k + 1))[:n]
print(len(min_repeat))
print(min_repeat)


(N, K) = map(int, input().split())
s = input()
subs = s[:K]
subs = subs * (N // K) + subs[:N % K]
if subs >= s:
	print(len(subs))
	print(subs)
else:
	subs = str(int(s[:K]) + 1)
	subs = subs * (N // K) + subs[:N % K]
	print(len(subs))
	print(subs)


(n, k) = map(int, input().split())
a = input()
b = list(a)
for i in range(0, n - k):
	b[i + k] = b[i]
if ''.join(b) < a:
	for i in range(k - 1, -1, -1):
		if b[i] < '9':
			b[i] = str(int(b[i]) + 1)
			break
		else:
			b[i] = '0'
	for i in range(0, n - k):
		b[i + k] = b[i]
print(len(b))
print(''.join(b))


(n, k) = list(map(int, input().split(' ')))
l = [int(i) for i in input()]
l1 = l[:]
for i in range(n - k):
	l[i + k] = l[i]
for j in range(n):
	if l1[j] > l[j]:
		temp = k - 1
		while temp >= 0 and l[temp] == 9:
			temp -= 1
		if temp == -1:
			l = [1] + [0] * n
			n = len(l)
		else:
			l[temp] += 1
			temp += 1
			while temp < k:
				l[temp] = 0
				temp += 1
		for i in range(n - k):
			l[i + k] = l[i]
		break
	elif l1[j] < l[j]:
		break
print(len(l))
print(*l, sep='')


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
digits = list(map(int, stdin.readline().strip()))
add = 0
inc = False
i = 0
while i < n - k:
	if digits[i] > digits[i + k]:
		digits[i + k] = digits[i]
		inc = True
	elif digits[i] < digits[i + k]:
		if not inc:
			for j in range(k - 1, -1, -1):
				digits[j] = (digits[j] + 1) % 10
				ofs = k
				while j + ofs <= i - 1 + k:
					digits[j + ofs] = digits[j]
					ofs += k
				if digits[j] != 0:
					break
			inc = True
		digits[i + k] = digits[i]
	i += 1
stdout.write('{}\n'.format(len(digits)))
stdout.write(''.join(list(map(str, digits))))


(n, k) = list(map(int, input().split()))
stringa = input()
stringb = ''
flag = 1
index1 = -1
for i in range(n):
	if flag == 0:
		break
	if i < k:
		continue
	else:
		if stringa[i] != stringa[i % k]:
			flag = 0
			if stringa[i] < stringa[i % k]:
				index = 1
			else:
				index = 2
				if stringa[k - 1] == '9':
					index1 = i % k
		if flag == 0:
			break
if flag == 0:
	print(n)
	if index == 1:
		print(stringa[:k] * (n // k) + stringa[:n % k])
	elif index == 2:
		if index1 != -1:
			for i in range(index1 + 1, k):
				if stringa[i] != '9':
					index1 = i
			lista = []
			for i in range(n):
				lista.append(stringa[i])
			for i in range(index1 + 1, k):
				lista[i] = '0'
			lista[index1] = str(int(lista[index1]) + 1)
			stringa = ''
			for i in range(n):
				stringa = stringa + lista[i]
			print(stringa[:k] * (n // k) + stringa[:n % k])
		else:
			print((stringa[:k - 1] + str(int(stringa[k - 1]) + 1)) * (n // k) + stringa[:n % k])
else:
	print(n)
	print(stringa)


(n, k) = map(int, input().split())
string = str(input())
num = int(string)
string = list(string)
for i in range(k, n):
	string[i] = string[i - k]
if num <= int(''.join(string)):
	print(len(string))
	print(''.join(string))
else:
	index = -1
	for j in range(k - 1, -1, -1):
		if string[j] != '9':
			string[j] = chr(ord(string[j]) + 1)
			index = j
			break
	if index != -1:
		for j in range(index + 1, k):
			if string[j] == '9':
				string[j] = '0'
	for i in range(k, n):
		string[i] = string[i - k]
	print(len(string))
	print(''.join(string))


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input()]
ans = a[:k]
while len(ans) < n:
	ans.append(ans[len(ans) - k])
if ans < a:
	i = k - 1
	while True:
		ans[i] += 1
		if ans[i] == 10:
			ans[i] = 0
			i -= 1
		else:
			break
	for i in range(k, n):
		ans[i] = ans[i - k]
print(n)
print(''.join([str(x) for x in ans]))


def increment(s):
	i = len(s) - 1
	while s[i] == '9':
		i -= 1
	s[i] = str(int(s[i]) + 1)
	for j in range(i + 1, len(s)):
		s[j] = '0'
	return s
(n, k) = map(int, input().split())
s = input()
s = list(s)
ans = s[0:k]
for i in range(k, n):
	ans.append(ans[i - k])
if ans >= s:
	add = 0
	print(len(ans))
	print(''.join(map(str, ans)))
	exit()
else:
	ans = increment(s[0:k])
	for i in range(k, n):
		ans.append(ans[i - k])
	print(len(ans))
	print(''.join(map(str, ans)))


(n, k) = map(int, input().split())
ss = [i for i in input()]
ok = ''.join(ss)
for i in range(k, n):
	ss[i] = ss[i - k]
if ''.join(ss) >= ok:
	print(n)
	print(''.join(ss))
else:
	chop = str(int(''.join(ss[:k])) + 1)
	ans = chop * (n // k) + chop[:n % k]
	print(n)
	print(ans)


from sys import exit
(n, k) = map(int, input().split())
s = input()
val = s[:k]
kek = val * (n // k) + val[:n % k]
if kek >= s:
	print(n)
	print(kek)
	exit(0)
else:
	for i in range(k - 1, -1, -1):
		if val[i] != '9':
			val = val[:i] + chr(ord(val[i]) + 1) + '0' * len(val[i + 1:])
			print(n)
			print(val * (n // k) + val[:n % k])
			exit(0)
n += 1
val = '1' + '0' * (k - 1)
print(n)
print(val * (n // k) + val[:n % k])


(n, k) = map(int, input().split())
x = input()
a = [int(d) for d in x]
b = [0] * n
for i in range(k):
	for j in range(i, n, k):
		b[j] = a[i]
ok = True
for i in range(n):
	if b[i] > a[i]:
		ok = True
		break
	elif b[i] == a[i]:
		pass
	else:
		ok = False
		break
if not ok:
	for i in range(k - 1, -1, -1):
		if a[i] == 9:
			a[i] = 0
		else:
			a[i] += 1
			break
for i in range(k):
	for j in range(i, n, k):
		a[j] = a[i]
print(n)
print(''.join(map(str, a)))


(n, k) = list(map(int, input().split()))
number = [int(i) for i in input()]
result = number.copy()
promene = 0
for i in range(k, n):
	result[i] = result[i - k]
if result < number:
	for i in range(k - 1, -1, -1):
		if result[i] < 9:
			result[i] += 1
			for j in range(i + k, n, k):
				result[j] = result[j - k]
			for L in range(i + 1, k):
				for j in range(L, n, k):
					result[j] = 0
			break
print(n)
for i in result:
	print(i, end='')
print()


from sys import exit
(n, k) = map(int, input().split(' '))
a = list(input())
firstK = a[:k]
b = []
while len(b) < n:
	b += firstK
b = b[:n]
if b >= a:
	print(n)
	print(''.join(b))
	exit(0)
else:
	for i in range(k - 1, -1, -1):
		if b[i] != '9':
			b[i] = chr(ord(b[i]) + 1)
			break
		b[i] = '0'
	firstK = b[:k]
	b = b[:k]
	while len(b) < n:
		b += firstK
	b = b[:n]
	print(n)
	print(''.join(b))


(n, k) = map(int, input().split())
a = list(map(int, input()))

def construct():
	l = k
	while l < n:
		r = min(l + k, n)
		a[l:r] = a[0:r - l]
		l += k

def output():
	print(n)
	for x in a:
		print(x, end='')
	print()
l = 0
while l < n:
	r = min(l + k, n)
	for i in range(l, r):
		if a[i] < a[i - l]:
			construct()
			output()
			exit()
		elif a[i] > a[i - l]:
			p = k - 1
			a[p] += 1
			while a[p] == 10:
				a[p] = 0
				p -= 1
				a[p] += 1
			construct()
			output()
			exit()
	l += k
output()


(n, k) = map(int, input().split())
it = list(input())
it = [int(i) for i in it]
ans = [0 for i in range(n)]
for i in range(k):
	for j in range(i, n, k):
		ans[j] = it[i]
st = True
for i in range(n):
	if ans[i] > it[i]:
		break
	if ans[i] == it[i]:
		continue
	st = False
if st:
	print(n)
	print(''.join([str(i) for i in ans]))
else:
	ans = [it[i] for i in range(k)]
	stt = 0
	for i in range(n):
		if it[i] > it[i % k]:
			ind = i
			break
	for i in range(k - 1, -1, -1):
		if ans[i] == 9:
			ans[i] = 0
			continue
		ans[i] += 1
		ind2 = i
		break
	ans2 = [0 for i in range(n)]
	for i in range(k):
		for j in range(i, n, k):
			ans2[j] = ans[i]
	print(n)
	print(''.join([str(i) for i in ans2]))


import os
import sys
from math import *
from collections import *
from heapq import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(n, k) = value()
a = [int(i) for i in input()]
b = a[:k]
need = False
for i in range(n):
	if a[i] < b[i % k]:
		need = False
		break
	if a[i] > b[i % k]:
		need = True
		break
ans = b
if need:
	ans = b[::-1]
	c = 1
	for i in range(len(ans)):
		t = ans[i]
		ans[i] = (t + c) % 10
		c = (t + c) // 10
	ans = ans[::-1]
ans = ans * (n // k + 1)
print(n)
print(*ans[:n], sep='')


(n, k) = map(int, input().split())
x = input()
odp = x[:k] * (n // k)
i = 0
while len(odp) < n:
	odp += x[i]
	i += 1
if int(odp) >= int(x):
	print(n)
	print(odp)
else:
	g = int(x[:k])
	g += 1
	h = str(g)
	odp = h * (n // k)
	i = 0
	while len(odp) < n:
		odp += h[i]
		i += 1
	print(n)
	print(odp)


(N, K) = [int(x) for x in input().split(' ')]
s = input()

def pad(s, n):
	return s * (n // len(s)) + s[:n % len(s)]
st = s[:K]
if pad(st, N) >= s:
	print(N)
	print(pad(st, N))
else:
	for i in reversed(range(K)):
		if st[i] != '9':
			st = st[:i] + chr(ord(st[i]) + 1) + '0' * (K - i - 1)
			break
	print(N)
	print(pad(st, N))


(N, K) = map(int, input().split())
A = input()
B = [A[i % K] for i in range(N)]
A_int = int(A)
B_int = int(''.join(B))
if B_int >= A_int:
	print(N)
	print(''.join(B))
else:
	Ak = str(int(A[:K]) + 1)
	B = [Ak[i % K] for i in range(N)]
	print(N)
	print(''.join(B))


import sys
import collections
from collections import Counter
import itertools
import math
import timeit

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
(n, k) = mi()
s = [x for x in input()]
t = s[:]
for i in range(n - k):
	t[i + k] = t[i]
print(n)
if t >= s:
	prr(t, '')
else:
	j = k - 1
	while t[j] == '9':
		t[j] = '0'
		for i in range(j + k, n, k):
			t[i] = t[i - k]
		j -= 1
	t[j] = str(int(t[j]) + 1)
	for i in range(j + k, n, k):
		t[i] = t[i - k]
	prr(t, '')


def a_gte_b(a, b):
	for i in range(len(a)):
		if a[i] == b[i]:
			continue
		return False if a[i] < b[i] else True
	return True

def set_i_multiples(arr, index, k, new_val):
	for i in range(index, len(arr), k):
		arr[i] = new_val
(_, k) = [int(n) for n in input().split()]
x = [int(n) for n in input()]
significant_k = []
i = 0
while i < len(x):
	significant_k.append(x[i % k])
	i += 1
i = k - 1
while i >= 0:
	if a_gte_b(significant_k, x):
		break
	if significant_k[i] < 9:
		set_i_multiples(significant_k, i, k, significant_k[i] + 1)
		if a_gte_b(significant_k, x):
			break
	set_i_multiples(significant_k, i, k, 0)
	i -= 1
print(len(significant_k))
print(*significant_k, sep='')


import math

def make(num_str, k):
	ans_str = num_str[0:k]
	while len(ans_str) < len(num_str):
		ans_str += ans_str
	if len(ans_str) > len(num_str):
		ans_str = ans_str[0:len(num_str)]
	if int(ans_str) < int(num_str):
		ans_str = str(int(ans_str[0:k]) + 1)
		while len(ans_str) < len(num_str):
			ans_str += ans_str
		if len(ans_str) > len(num_str):
			ans_str = ans_str[0:len(num_str)]
	print(len(ans_str))
	print(ans_str)
	return
st = input().split()
n = int(st[0])
k = int(st[1])
num = input()
make(num, k)


import math
(n, k) = map(int, input().split())
a = input()
print(n)
if n == 1:
	print(a)
else:
	prefix = a[:k]
	cnt = int(math.ceil(n / k))
	tmp1 = prefix * cnt
	tmp1 = tmp1[:n]
	if int(tmp1) >= int(a):
		print(tmp1)
	else:
		prefix = str(int(prefix) + 1)
		tmp2 = prefix * cnt
		tmp2 = tmp2[:n]
		print(tmp2)


(n, m) = map(int, input().split())
x = input()
flag = True
flagus = False
s = [0] * n
for i in range(m):
	s[i] = x[i]
for i in range(m, n):
	s[i] = s[i - m]
	if int(s[i]) < int(x[i]) and (not flagus):
		flag = False
		break
	if int(s[i]) > int(x[i]):
		flagus = True
if flag:
	print(n)
	print(*s, sep='')
else:
	pos = -1
	s = str(int(x[:m]) + 1)
	print(n)
	print(s, end='')
	for j in range(m, n):
		print(s[j % m], end='')


(n, k) = map(int, input().split(' '))
a = input()
ans = [0 for _ in range(n)]
visited = [False for _ in range(n)]
tight = True
bad = False
assigned = []
for i in range(n):
	if visited[i]:
		if ans[i] > ord(a[i]) - ord('0'):
			tight = False
		elif ans[i] < ord(a[i]) - ord('0') and tight:
			bad = True
		continue
	assigned.append(i)
	curr = ord(a[i]) - ord('0') if tight else 0
	for j in range(i, n, k):
		visited[j] = True
		ans[j] = curr
assigned = assigned[::-1]
if bad:
	for i in assigned:
		if ans[i] is not 9:
			for j in range(i, n, k):
				ans[j] += 1
			break
		else:
			for j in range(i, n, k):
				ans[j] = 0
print(n)
[print(i, end='') for i in ans]


def check(arr, n, k):
	for i in range(n - k):
		if arr[i] != arr[i + k]:
			return False
	return True

def check1(arr, n, k):
	for i in range(k):
		if arr[i] != '9':
			return False
	return True

def check3(arr, n, k):
	for i in range(n - k):
		if arr[i] > arr[i + k]:
			return True
		if arr[i] < arr[i + k]:
			return False
	return True
(n, k) = map(int, input().split())
a = list()
arr = input()
for i in range(n):
	a.append(int(arr[i]))
flag = 0
carry = 0
if check(arr, n, k):
	print(len(arr))
	print(arr)
else:
	if check1(arr, n, k):
		for i in range(n - k):
			a[i + k] = a[i]
	elif check3(arr, n, k):
		for i in range(n - k):
			a[i + k] = a[i]
	else:
		for i in range(k - 1, -1, -1):
			if a[i] == 9 and i == k - 1:
				a[i] = 0
				carry = 1
			elif i == k - 1:
				a[i] += 1
			elif a[i] == 9 and carry == 1:
				a[i] = 0
				carry = 1
			elif carry == 1:
				a[i] += 1
				carry = 0
		for i in range(n - k):
			a[i + k] = a[i]
	print(len(a))
	for i in range(len(a)):
		print(a[i], end='')
	print()


(n, k) = map(int, input().split())
a = list(map(int, input()))
for i in range(k, n):
	if a[i] < a[i % k]:
		a[i] = a[i % k]
		for j in range(i, n):
			a[j] = a[j % k]
		break
	elif a[i] > a[i % k]:
		j = k - 1
		while a[j] == 9:
			j -= 1
		a[j] += 1
		for jj in range(j, n, k):
			a[jj] = a[j]
		for jj in range(j + 1, k):
			a[jj] = 0
		for jj in range(k, n):
			a[jj] = a[jj % k]
		break
print(n)
print(''.join(map(str, a)))


(n, k) = input().split()
n = int(n)
k = int(k)
s = input()
sub = s[0:k]
for i in range(0, n, k):
	tlen = min(k, n - i)
	ts = s[i:i + tlen]
	if ts < sub:
		break
	elif ts == sub:
		continue
	else:
		sub = str(int(sub) + 1)
		break
print(n)
for i in range(0, n, k):
	tlen = min(k, n - i)
	print(sub[0:tlen], end='')
print()


(n, k) = map(int, input().split())
num = list(input())
temp = int(''.join(num))
for i in range(n - k):
	num[i + k] = num[i]
b = ''.join(num)
if int(b) >= temp:
	print(n)
	print(''.join(num))
else:
	x = 0
	for i in range(0, k):
		if num[i] != '9':
			x = i
	for i in range(x + 1, k):
		if num[i] == '9':
			num[i] = '0'
	num[x] = str(int(num[x]) + 1)
	for i in range(n - k):
		num[i + k] = num[i]
	print(n)
	print(''.join(num))


(n, k) = map(int, input().split())
a = list(input())
increased = False
for i in range(k, n):
	if increased or a[i] < a[i % k]:
		increased = True
		continue
	if a[i] > a[i % k]:
		x = int(''.join(a[:k]))
		for (i, c) in enumerate(str(x + 1)):
			a[i] = c
		break
for i in range(k, n):
	a[i] = a[i % k]
print(n)
print(''.join(a))


import math, sys
from collections import Counter, defaultdict, deque
from sys import stdin, stdout
input = stdin.readline
lili = lambda : list(map(int, sys.stdin.readlines()))
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
S = lambda : input().strip()
(n, k) = li()
p = list(S())
s = p.copy()
for i in range(k, n):
	s[i] = s[i - k]
if ''.join(map(str, s)) >= ''.join(map(str, p)):
	print(len(s))
	print(''.join(map(str, s)))
	exit()
for i in range(k - 1, -1, -1):
	if s[i] != '9':
		for j in range(i, n, k):
			s[j] = str(int(s[j]) + 1)
		break
	else:
		for j in range(i, n, k):
			s[j] = '0'
print(len(s))
print(''.join(map(str, s)))


import sys
import math as mt
import bisect
input = sys.stdin.readline
t = 1

def solve():
	ch = 0
	opt = n + 2
	for i in range(k - 1, -1, -1):
		if l[i] < 9:
			opt = i
			break
	for i in range(k):
		if i < k:
			j = i
			while j < n:
				l1[j] = l[i]
				j += k
	min_ind = 0
	for i in range(n):
		if l[i] < l1[i]:
			ch = 0
			break
		if l[i] > l1[i]:
			ch = 1
			break
	if ch == 0:
		return l1
	for i in range(n):
		l1[i] = l[i]
	for i in range(k):
		j = i
		if i < opt:
			while j < n:
				l1[j] = l[i]
				j += k
		elif i == opt:
			while j < n:
				l1[j] = l[i] + 1
				j += k
		else:
			while j < n:
				l1[j] = 0
				j += k
	return l1
for _ in range(t):
	(n, k) = map(int, input().split())
	s = input()
	l = []
	for i in range(n):
		l.append(int(s[i]))
	ch = 0
	ch1 = 0
	l1 = [0] * n
	for i in range(n):
		l1[i] = l[i]
	ans = solve()
	print(n)
	print(*ans, sep='')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
a = [str(k) for k in input()]
firstk = []
for j in range(k):
	firstk.append(a[j])
c1 = 0
alr = False
for j in range(n):
	if firstk[j % k] > a[j]:
		alr = True
		c1 += 1
	elif firstk[j % k] == a[j]:
		c1 += 1
	elif firstk[j % k] < a[j]:
		break
if alr == True or c1 == n:
	print(n)
	for j in range(n - k):
		firstk.append(firstk[-k])
	print(''.join(firstk))
else:
	for j in range(k - 1, -1, -1):
		if int(firstk[j]) < 9:
			firstk[j] = str(int(firstk[j]) + 1)
			for s in range(j + 1, k):
				firstk[s] = '0'
			break
	for j in range(n - k):
		firstk.append(firstk[-k])
	print(n)
	print(''.join(firstk))


from math import ceil
(n, k) = [int(x) for x in input().split()]
x = input()
s1 = x[:k]
ans = s1 * ceil(n / k)
ans = ans[:n]
if int(ans) < int(x):
	ans = ''
	s1 = str(int(s1) + 1)
	ans = s1 * ceil(n / k)
	ans = ans[:n]
print(len(ans))
print(ans)


(n, k) = list(map(int, input().split()))
a = list(map(int, list(input())))
base = a[:k]
increment = False
for i in range(n):
	k_i = i % k
	if base[k_i] > a[i]:
		break
	if base[k_i] < a[i]:
		increment = True
		break
if increment:
	carry = 0
	base[-1] = (base[-1] + 1) % 10
	if base[-1] == 0:
		carry = 1
	for i in range(k - 2, -1, -1):
		base[i] = (base[i] + carry) % 10
		if base[i] != 0:
			break
print(n)
for i in range(n):
	print(base[i % k], end='')
print()


def increment_string_integer(pattern):
	pattern_list = list(pattern)
	for i in range(len(pattern) - 1, -1, -1):
		if ord(pattern_list[i]) == 57:
			pattern_list[i] = '0'
			continue
		pattern_list[i] = chr(ord(pattern_list[i]) + 1)
		break
	return ''.join(pattern_list)
(n, k) = [int(x) for x in input().split()]
s = input()
pattern = s[:k]
for i in range(n):
	current_pattern_char = pattern[i % k]
	current_string_char = s[i]
	if current_pattern_char == current_string_char:
		continue
	if ord(current_pattern_char) > ord(current_string_char):
		break
	else:
		pattern = increment_string_integer(pattern)
		break
number_of_patterns = n // k
number_of_patterns += 1 if n % k != 0 else 0
res = pattern * number_of_patterns
res = res[:n]
print(n)
print(res)


import math
(n, k) = map(int, input().split())
a = input()
if n == 1:
	print(1)
	print(a)
else:
	prefix = a[:k]
	cnt = int(math.ceil(n / k))
	for i in range(2):
		tmp = prefix * cnt
		tmp = tmp[:n]
		if tmp >= a:
			print(n)
			print(tmp)
			break
		prefix = str(int(prefix) + 1)


import sys

def newALessA(newa, a):
	for i in range(len(newa)):
		if newa[i] > a[i]:
			return False
		elif newa[i] < a[i]:
			return True
	return False

def plus(a, i):
	a[i] += 1
	for j in range(i, -1, -1):
		if a[j] == 10:
			a[j - 1] += 1
			a[j] = 0
(n, k) = list(map(int, sys.stdin.readline().split()))
a = list(sys.stdin.readline())
a.pop()
newa = a[:k]
newa = newa.copy() * (len(a) // k + 1)
newa = list(map(int, newa))
newa = newa[:len(a)]
a = list(map(int, a))
if newALessA(newa, a):
	plus(newa, k - 1)
	ans = newa[:k]
	ans = ans.copy() * (len(newa) // k + 1)
	ans = ''.join(list(map(str, ans[:len(newa)])))
	sys.stdout.write(str(len(ans)))
	sys.stdout.write('\n')
	sys.stdout.write(ans)
else:
	newa = list(map(str, newa))
	sys.stdout.write(str(len(newa)))
	sys.stdout.write('\n')
	sys.stdout.write(''.join(newa))


def possible(pos):
	if pos >= k:
		return num[:k] * int(n / k) + num[:n % k]
	ret = num[:pos] + str(int(num[pos]) + 1) + '0' * int(k - pos - 1)
	ret = ret * int(n / k) + ret[:n % k]
	return ret
(n, k) = map(int, input().split())
num = input()
for i in reversed(range(k + 1)):
	s1 = possible(i)
	if len(s1) == n and s1 >= num:
		print(len(s1), s1, sep='\n')
		break


(n, k) = map(int, input().split())
arr = input()
s = list(arr[:k])
for i in range(n):
	if arr[i % k] < arr[i]:
		if i >= k:
			i = k - 1
			while s[i] == '9':
				s[i] = '0'
				i -= 1
			s[i] = str(int(s[i]) + 1)
		else:
			s[i] = str(int(s[i]) + 1)
		break
	if arr[i % k] > arr[i]:
		break
print(n)
v = ''.join(s)
for i in range(n // k):
	print(v, end='')
print(v[:n % k])


(n, k) = [int(x) for x in input().split(' ')]
s = input()
s1 = s
s = s[:k]
a = n // k
if n % k != 0:
	a += 1
s *= a
s = s[:n]
if s >= s1:
	print(n)
	print(s)
else:
	f = 0
	for i in range(k - 1, -1, -1):
		if s[i] != '9':
			s = s[:i] + chr(ord(s[i]) + 1) + (k - 1 - i) * '0'
			s *= a
			s = s[:n]
			f = 1
			break
	if f == 0:
		s = '1' + n * '0'
	print(len(s))
	print(s)


(n, k) = list(map(int, input().split()))
x = input()
(repeat, left) = divmod(n, k)
sub = ''
for i in range(k):
	sub += x[i]
result = sub * repeat
if left > 0:
	result += sub[:left]
if int(result) < int(x):
	sub = str(int(sub) + 1)
result = sub * repeat
if left > 0:
	result += sub[:left]
print(n)
print(result)


import sys
from array import array

def input():
	return sys.stdin.buffer.readline().decode('utf-8')
(n, k) = map(int, input().split())
a = list(map(int, input().rstrip()))
visited = [0] * n
(up, low) = (n + 1, n + 1)
for i in range(n):
	if visited[i] or i + k >= n:
		break
	visited[i::k] = [1] * ((n - i + k - 1) // k)
	cnt = [0] * 10
	for j in range(i, n, k):
		cnt[a[j]] += 1
		if a[i] < a[j]:
			low = min(low, j)
		elif a[i] > a[j]:
			up = min(up, j)
	if cnt[a[i]] == sum(cnt):
		continue
	a[i::k] = [a[i]] * ((n - i + k - 1) // k)
if low < up:
	for i in range(k - 1, -1, -1):
		if a[i] != 9:
			a[i] += 1
			a[i::k] = [a[i]] * ((n - i + k - 1) // k)
			for j in range(i + 1, k):
				a[j::k] = [0] * ((n - j + k - 1) // k)
			for j in range(i + 1, n):
				if not visited[j]:
					a[j] = 0
			break
print(n)
print(*a, sep='')


import math
(n, k) = map(int, input().split())
s = input()
last_non_nine = None
for i in range(k - 1, -1, -1):
	if s[i] != '9':
		last_non_nine = i
		break
if last_non_nine == None:
	print(n)
	print('9' * n)
else:
	block = []
	min_increase = math.inf
	min_decrease = math.inf
	for i in range(last_non_nine + 1):
		current_index = i
		block.append(s[i])
		while current_index < n:
			if int(s[current_index]) > int(s[i]):
				min_decrease = min(min_decrease, current_index)
			elif int(s[current_index]) < int(s[i]):
				min_increase = min(min_increase, current_index)
			current_index += k
	if min_increase > min_decrease:
		block.pop()
		block.append(str(int(s[last_non_nine]) + 1))
		block += ['0'] * (k - len(block))
	else:
		block += ['9'] * (k - len(block))
	print(n)
	print(''.join(block * (n // k) + block[:n % k]))


(n, k) = map(int, input().split())
a = [int(x) for x in input()]

def check(a, n, k):
	flg = True
	for i in range(k, n, k):
		for j in range(k):
			if i + j < n:
				if a[i + j] > a[j]:
					return False
				elif a[i + j] < a[j]:
					return True
		if flg == False:
			break
	return flg

def add(arr, k):
	r = 1
	for i in range(k - 1, -1, -1):
		temp = r
		r = (arr[i] + temp) // 10
		arr[i] = (arr[i] + temp) % 10
	return arr

def make(arr, k, n):
	ans = []
	while len(ans) < n:
		ans.extend(arr[:min(k, n - len(ans))])
	return ans
if check(a, n, k) == True:
	ans = make(a, k, n)
else:
	ans = make(add(a[:k], k), k, n)
print(n)
print(''.join((str(x) for x in ans)))


(n, k) = map(int, input().split())
y = input()
print(n)
check = y[:k]
check = check * (n // k) + check[:n % k]
if check >= y:
	print(check)
else:
	carry = str(int(check[:k]) + 1)
	carry = carry * (n // k) + carry[:n % k]
	print(carry)


(n, k) = list(map(int, input().split()))
s = input()
t = s[:k]
t = t * (n // k) + t[:n % k]
if int(t) < int(s):
	t = str(int(s[:k]) + 1)
	t = t * (n // k) + t[:n % k]
print(len(t), t, sep='\n')


(n, k) = map(int, input().split())
s = input()
x = s[:k] * (n // k) + s[:n % k]
print(n)
if s <= x:
	print(x)
else:
	v = str(int(s[:k]) + 1)
	x = v * (n // k) + v[:n % k]
	print(x)


(n, k) = map(int, input().split())
s = input()
flag = 1
for i in range(len(s) - k):
	if s[i] == s[i + k]:
		continue
	else:
		if s[i] < s[i + k]:
			flag = 0
			break
		break
if flag == 0:
	s1 = str(int(s[0:k]) + 1)
else:
	s1 = s[0:k]
i = 0
l = 0
print(n)
while l < len(s):
	print(s1[i], end='')
	i = (i + 1) % len(s1)
	l += 1


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
s = input()
a = list()
for i in s:
	a.append(int(i))
b = list(a)
ch = 1
for i in range(k, n):
	a[i] = a[i - k]
l = 0
m = 0
for i in range(n):
	if a[i] > b[i]:
		m += 1
	if b[i] > a[i]:
		l += 1
	if l > 0 and m == 0:
		ch = 0
if ch == 1 or a == b:
	print(n)
	print(*a, sep='')
else:
	f = -1
	for i in range(k):
		if a[i] != 9:
			f = i
	a[f] += 1
	for i in range(f + 1, k):
		a[i] = 0
	for i in range(k, n):
		a[i] = a[i - k]
	print(n)
	print(*a, sep='')


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
(n, k) = map(int, input().split())
x = int(input())
s = str(x)
ans = ['0'] * n
flag = 0
for i in range(n):
	if i - k >= 0:
		ans[i] = ans[i - k]
		if ans[i] < s[i] and flag == 0:
			flag = 1
			break
		elif ans[i] > s[i]:
			flag = 2
	else:
		ans[i] = s[i]
s1 = ''.join(ans)
if not flag or flag == 2:
	print(n)
	print(s1)
	exit()
flag = 0
ans = ['0'] * n
for i in range(k - 1, -1, -1):
	if s[i] == '9':
		continue
	else:
		ans[i] = str(int(s[i]) + 1)
		flag = 1
		for j in range(i + 1, k - 1):
			ans[j] = '0'
		for j in range(i):
			ans[j] = s[j]
		break
if flag:
	for i in range(k, n):
		if i - k < 0:
			continue
		else:
			ans[i] = ans[i - k]
	print(len(ans))
	print(''.join(ans))
elif s[0] != '9':
	for i in range(n):
		if i - k < 0:
			if i == 0:
				ans[i] = str(int(s[i]) + 1)
			else:
				ans[i] = '0'
		else:
			ans[i] = ans[i - k]
	print(len(ans))
	print(''.join(ans))
else:
	ans += ['0']
	for i in range(n + 1):
		if i - k < 0:
			if i == 0:
				ans[i] = '1'
			else:
				ans[i] = '0'
		else:
			ans[i] = ans[i - k]
	print(len(ans))
	print(''.join(ans))


(n, k) = map(int, input().split())
s = [int(i) for i in input()]
t = [i for i in s]
for i in range(k, n):
	t[i] = t[i - k]
if ''.join(map(str, t)) >= ''.join(map(str, s)):
	print(len(t))
	print(''.join(map(str, t)))
	exit()
for i in range(k - 1, -1, -1):
	if t[i] != 9:
		for j in range(i, n, k):
			t[j] += 1
		break
	else:
		for j in range(i, n, k):
			t[j] = 0
print(len(t))
print(''.join(map(str, t)))


class LLNode:

	def __init__(self, data):
		self.data = data
		self.next = None
		self.prev = None

class LL:

	def __init__(self):
		self.head = None

	def push(self, new_data):
		new_node = LLNode(new_data)
		new_node.next = self.head
		if self.head is not None:
			self.head.prev = new_node
		self.head = new_node

	def insertAfter(self, prev_node, new_data):
		if prev_node is None:
			print('the given previous node cannot be NULL')
			return
		new_node = LLNode(new_data)
		new_node.next = prev_node.next
		prev_node.next = new_node
		new_node.prev = prev_node
		if new_node.next is not None:
			new_node.next.prev = new_node
		return new_node

	def append(self, new_data):
		new_node = LLNode(new_data)
		new_node.next = None
		if self.head is None:
			new_node.prev = None
			self.head = new_node
			return
		last = self.head
		while last.next is not None:
			last = last.next
		last.next = new_node
		new_node.prev = last
		return new_node

	def printList(self, node):
		print('\nTraversal in forward direction')
		while node is not None:
			print(' % d', node.data)
			last = node
			node = node.next
		print('\nTraversal in reverse direction')
		while last is not None:
			print(' % d', last.data)
			last = last.prev

class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L
c = cinn()
n = c.cin()
k = c.cin()
x = c.cin()
s = str(x)
br = True
for i in range(n):
	if s[i] > s[i % k]:
		br = False
		break
	if s[i] < s[i % k]:
		br = True
		break
if not br:
	sp = s[0:k]
	s = str(int(sp) + 1)
print(n)
for i in range(n):
	print(s[i % k], end='')


def makeItOk(li):
	p1 = len(x) // k - 1
	p2 = p1 - 1
	while True:
		if int(li[p2]) < int(li[p1]):
			li[p2] = str(int(li[p2]) + 1)
		if p2 == 0:
			break
		(p1, p2) = (p2, p2 - 1)
(n, k) = input().split()
n = int(n)
k = int(k)
x = input()
while len(x) % k != 0:
	x += '0'
li = []
for i in range(0, n, k):
	li.append(x[i:i + k])
makeItOk(li)
res = li[0] * (n // k) + li[0][:n % k]
print(n)
print(res)


(n, k) = map(int, input().split())
ar = list(map(int, list(input())))
li = [1] + [0] * (k - 1)
rou = 0
for i in range(n):
	j = i % k
	rou = i // k
	if li[j] > ar[i]:
		break
	elif li[j] < ar[i]:
		if rou == 0:
			li[j] = ar[i]
		else:
			li[-1] += 1
			break
li = li[::-1]
for i in range(k):
	if li[i] > 9:
		li[i] = 0
		li[i + 1] += 1
li = li[::-1]
st = ''
for i in range(n):
	j = i % k
	st += str(li[j])
print(n)
print(st)


(n, k) = map(int, input().split())
temp = str(input())
a = [int(i) for i in temp]
for i in range(n - k):
	a[i + k] = a[i]
if str(''.join(map(str, a))) >= temp:
	print(n)
	print(''.join(map(str, a)))
else:
	ind = k - 1
	while ind >= 0:
		if a[ind] < 9:
			a[ind] += 1
			break
		else:
			ind -= 1
	if ind >= 0:
		ind += 1
		for i in range(ind, k):
			a[i] = 0
		for i in range(0, n - k):
			a[i + k] = a[i]
		print(n)
		print(''.join(map(str, a)))


import sys

def solvecase():
	(n, k) = map(int, input().split())
	dig = str(input())
	rep = n // k
	rem = n % k
	portion = dig[0:k]
	first = portion * rep + portion[:rem]
	print(n)
	if int(first) >= int(dig):
		print(first)
	else:
		portion = str(int(dig[0:k]) + 1)
		second = portion * rep + portion[:rem]
		print(second)
cases = 1
while cases > 0:
	solvecase()
	cases -= 1


a = input().split(' ')
n = int(a[0])
k = int(a[1])
string = input()
print(n)
cpstr = string[0:k] * (n // k)
for i in range(n % k):
	cpstr += string[i]
if int(cpstr) >= int(string):
	print(cpstr)
	quit(0)
dec = int(cpstr[0:k])
dec += 1
dec = str(dec)
dec = dec[0:k] * (n // k)
for i in range(n % k):
	dec += dec[i]
print(dec)


import sys
(n, k) = map(int, sys.stdin.readline().split())
x = sys.stdin.readline().rstrip()
a = list(x)
x = int(x)

def main():
	b = a.copy()
	m = n
	for i in range(m - k):
		b[i + k] = b[i]
	if int(''.join(b)) < x:
		for j in range(k - 1, -1, -1):
			b[j] = int(b[j]) + 1
			if b[j] < 10:
				b[j] = str(b[j])
				break
			b[j] = '0'
		if b[0] == '0':
			m = n + 1
			b = ['0'] * m
			b[0] = '1'
		for i in range(m - k):
			b[i + k] = b[i]
	yield m
	yield ''.join(b)
ans = main()
print(*ans, sep='\n')


(n, k) = map(int, input().split())
x = input()
tmp = x[0:k]
res = tmp * int(n / k) + tmp[0:n - int(n / k) * k]
if res < x:
	tmp = str(int(tmp) + 1)
	res = tmp * int(n / k) + tmp[0:n - int(n / k) * k]
print(len(res))
print(res)


def testcase(fun):
	args = [(1, str(199))]
	prev = 0
	for a in args:
		result = fun(*a)
		if result == prev:
			continue
		prev = result
		print(a[1], result)

def IO(fun):

	def infun():
		(n, k) = input().split(' ')
		S = input()
		return (int(k), S)

	def outfun(S):
		print(len(S))
		print(S)
	result = fun(*infun())
	outfun(result)
	return fun

@IO
def sol(k, S):
	n = len(S)

	def ext(slice, n):
		return slice * (n // len(slice)) + slice[:n % len(slice)]
	head = S[:k]
	e = ext(head, n)
	if e >= S:
		return e
	else:
		h2 = int(head) + 1
		return ext(str(h2), n)


import sys
input = sys.stdin.readline
(n, k) = [int(item) for item in input().split()]
s = input().rstrip()
s = [int(item) for item in s]
loose_from = -1
for (i, item) in enumerate(s):
	if i - k < 0:
		continue
	if item > s[i - k]:
		loose_from = k - 1
		break
	elif item < s[i - k]:
		loose_from = i
		break
if loose_from == -1:
	print(len(s))
	print(''.join([str(item) for item in s]))
	exit()
while loose_from >= 0 and s[loose_from] == 9:
	loose_from -= 1
if loose_from - k >= 0:
	s[loose_from] = s[loose_from - k]
else:
	s[loose_from] += 1
for i in range(loose_from + 1, n):
	if i - k < 0:
		s[i] = 0
	else:
		s[i] = s[i - k]
print(len(s))
print(''.join([str(item) for item in s]))


(n, k) = map(int, input().split())
s = input()
p = list(s)
for i in range(n - k):
	if p[i] != p[i + k]:
		p[i + k] = p[i]
if ''.join(p) < s:
	for i in range(k - 1, -1, -1):
		if p[i] != '9':
			x = i
			break
	p[x] = str(int(p[x]) + 1)
	for j in range(x + 1, n):
		if p[j] == '9':
			p[j] = '0'
	for i in range(n - k):
		if p[i] != p[i + k]:
			p[i + k] = p[i]
l = ''.join(p)
print(len(l))
print(l)


import sys
(n, k) = map(int, input().split(' '))
s = input()
prefix = s[:k]
t = prefix * (len(s) // k + 5)
t = t[:len(s)]
if t < s:
	prefix = str(int(prefix) + 1)
	t = prefix * (len(s) // k + 5)
	t = t[:len(s)]
print(len(t))
print(t)


(n, k) = map(int, input().split())
x = str(input())
pre = x[:k]
if (pre * (n // k + 1))[:n] < x:
	pre = str(int(pre) + 1)
print(n)
print((pre * (n // k + 1))[:n])


import os
from io import BytesIO
(n, k) = map(int, input().split())
s = input()
greater = False
print(n)
for i in range(k, n):
	if s[i] > s[i % k] and (not greater):
		break
	elif s[i] < s[i % k]:
		greater = True
else:
	ans = [''] * n
	for i in range(k):
		for j in range(i, n, k):
			ans[j] = s[i]
	print(*ans, sep='')
	exit()
i = k - 1
while s[i] == '9':
	i -= 1
ans = list(s[:i]) + [chr(ord(s[i]) + 1)] + ['0'] * (n - i - 1)
for i in range(k):
	for j in range(i + k, n, k):
		ans[j] = ans[i]
print(*ans, sep='')


def is_beautiful(x, k):
	for i in range(len(x) - k):
		if x[i] != x[i + k]:
			return False
	return True
s = input()
ints = list(map(int, s.split()))
(non, k) = (ints[0], ints[1])
xi = input()
n = len(xi)
k_n = xi[:k]
pos_ans = k_n * (n // k) + k_n[:n % k]
if int(pos_ans) >= int(xi):
	print(len(pos_ans))
	print(pos_ans)
else:
	k_n = str(int(k_n) + 1)
	pos_ans = k_n * (n // k) + k_n[:n % k]
	print(len(pos_ans))
	print(pos_ans)


(n, k) = map(int, input().split())
s = list(input())
i = 0
s_k = s[:k]
change = 0
for i in range(k, n):
	if s_k[i % k] > s[i]:
		change = 0
		break
	elif s_k[i % k] < s[i]:
		change = 1
		break
if change == 1:
	br = 0
	for i in range(1, len(s_k) + 1):
		br = i
		if s_k[-i] != '9':
			s_k[-i] = chr(ord(s_k[-i]) + 1)
			break
	s_k = s_k[:k - br + 1] + ['0'] * (br - 1)
ans = ''.join(s_k * (n // k) + s_k[:n % k])
print(n)
print(ans)


from sys import stdout
l = input().split()
n = int(l[0])
k = int(l[1])
x = input()
xl = int(x[:k])
ans = (str(xl) * (n // k + 1))[:n]
for i in range(n):
	if ans[i] > x[i]:
		break
	if ans[i] < x[i]:
		xl += 1
		ans = (str(xl) * (n // k + 1))[:n]
		break
stdout.write('%s\n%s\n' % (len(ans), ans))


(n, k) = list(map(int, input().split()))
a = input()
c = a[:k] * int(len(a) / k) + a[:len(a) % k]
if int(a) <= int(c):
	print(len(c))
	print(c)
else:
	b = str(int(a[:k]) + 1)
	c = b * int(len(a) / k) + b[:len(a) % k]
	print(len(c))
	print(c)


(n, k) = map(int, input().split())
a = ''.join(str(input()))
q = n // k
r = n % k
c = a[:k]
t = True
if a[k:] > c * q + c[:r]:
	t = False
print(n)
if t:
	c = c * q
	res = c + c[:r]
	print(res)
else:
	i = k - 1
	res = ''
	while i > -1 and c[i] == '9':
		res = '0' + res
		i -= 1
	res = str(int(c[i]) + 1) + res
	res = c[:k - len(res)] + res
	print(res * q + res[:r])


(n, k) = map(int, input().split())
a = list(map(int, input()))
ret = [None] * n
for i in range(n):
	if ret[i] == None:
		for j in range(i, n, k):
			ret[j] = a[i]
for i in range(n):
	if ret[i] > a[i]:
		break
	if ret[i] < a[i]:
		maxPos = -1
		for j in range(i, -1, -1):
			if a[j % k] != 9:
				maxPos = max(maxPos, j % k)
		if maxPos == -1:
			raise Exception
		for j in range(maxPos, n):
			if (j - maxPos) % k == 0:
				ret[j] = a[maxPos] + 1
			elif j % k != 0:
				ret[j] = 0 if j < k else ret[j % k]
		break
print(n)
print(''.join(map(str, ret)))


(n, m) = map(int, input().split())
A = input()
num = A[:m]
for i in range(m, len(A), m):
	if num > A[i:i + m]:
		break
	if num < A[i:i + m]:
		num = str(int(num) + 1)
		break
print(n)
print(num * (n // m), end='')
print(num[:n % m])


(n, k) = map(int, input().split())
s = input()
l = list(s)
for i in range(k, len(s)):
	l[i] = l[i - k]
a = ''.join(l)
if a >= s:
	print(len(a))
	print(a)
else:
	b = l[:k]
	b = ''.join(b)
	b = int(b) + 1
	b = str(b)
	c = l[k:]
	c = ''.join(c)
	b += c
	b = list(b)
	for i in range(k, len(b)):
		b[i] = b[i - k]
	b = ''.join(b)
	print(len(b))
	print(b)


from sys import stdin, stdout
from math import gcd
input = stdin.readline
(n, k) = map(int, input().split())
s = input()[:-1]
for i in range(n):
	if s[i] > s[i % k]:
		t = s[:k]
		t = str(int(t) + 1)
		exit(print(n, (t * ((n + k - 1) // k))[:n], sep='\n'))
	elif s[i] < s[i % k]:
		exit(print(n, (s[:k] * ((n + k - 1) // k))[:n], sep='\n'))
print(n, (s[:k] * ((n + k - 1) // k))[:n], sep='\n')


(n, k) = map(int, input().split())
x = input()
y = x[:k] * (n // k) + x[:n % k]
if y < x:
	y = str(int(x[:k]) + 1) * (n // k)
	y += y[:n % k]
print(len(y))
print(y)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
s = input()
ans = ''
tight = 1
ans = s[:k]
ans = ans * (n // k) + ans[:n % k]
s = s.strip()
ans = ans.strip()
if ans >= s:
	print(len(ans))
	print(ans)
else:
	now = s[:k]
	now = str(int(now) + 1)
	ans = now * (n // k) + now[:n % k]
	print(len(ans))
	print(*ans, sep='')


(n, k) = map(int, input().split())
x = list(input())
s = ''
q = ''
b = x[0:k] * (n // k) + x[0:n % k]
if b >= x:
	print(n)
	print(*b, sep='')
else:
	p = list(str(int(s.join(x[0:k])) + 1))
	q = p * (n // k) + p[0:n % k]
	print(n)
	print(*q, sep='')


import sys
input = lambda : sys.stdin.readline().strip()
(n, k) = map(int, input().split())
s = input()
ans = ''.join(s[:k])
if int(ans * (n // k) + ans[:n % k]) < int(s):
	ans = str(int(ans) + 1)
print(n)
print(ans * (n // k) + ans[:n % k])


(n, k) = map(int, input().split())
a = [int(x) for x in list(input())]
stable = [0] * n
for i in range(n):
	if stable[i] == 0:
		stable[i] = 2
	if i + k >= n:
		continue
	if a[i] > a[i + k]:
		stable[i + k] = 1
	elif a[i] == a[i + k]:
		stable[i + k] = 2
	else:
		stable[i + k] = 3
	a[i + k] = a[i]
fin = True
for i in range(n):
	if stable[i] == 1:
		print(len(a))
		print(*a, sep='')
		exit(0)
	if stable[i] == 3:
		point = i
		fin = False
		break
if fin == True:
	print(n)
	print(*a, sep='')
	exit(0)
pos = k - 1
while a[pos] == 9:
	pos -= 1
a[pos] += 1
for i in range(pos + 1, k):
	a[i] = 0
print(n)
for i in range(n):
	print(a[i % k], end='')
print('')


(n, k) = map(int, input().split())
a = input()
b = a[:k]
(q, r) = (n // k, n % k)
c = b * q + b[:r]
if a <= c:
	print(len(c))
	print(c)
else:
	b = str(int(b) + 1)
	c = b * q + b[:r]
	print(len(c))
	print(c)


import sys

def input():
	return sys.stdin.readline().rstrip()

def ceil(x, y):
	return (x + y - 1) // y

def slv():
	(n, k) = map(int, input().split())
	BigDigit = input()
	if BigDigit == '9' * n:
		print(len(BigDigit))
		print(BigDigit)
		return
	d = BigDigit[:k]

	def expand(d):
		(u, v) = divmod(n, k)
		tmpl = [d] * u + [d[:v]]
		ans = ''.join(tmpl)
		return ans
	candidate_answer = expand(d)
	if int(candidate_answer) >= int(BigDigit):
		ans = candidate_answer
		print(len(ans))
		print(ans)
		return
	else:
		candidate_answer = expand(str(int(d) + 1))
		print(len(candidate_answer))
		print(candidate_answer)
	return

def main():
	t = 1
	for i in range(t):
		slv()
	return
main()


(n, k) = map(int, input().split())
a = input()
if a.count(a[0]) == n:
	print(n)
	print(a)
else:
	b = ''
	for i in range(k):
		b += a[i]
	b = (b * (n // k + 5))[0:n]
	if b >= a:
		print(n)
		print(b)
	else:
		i = k - 1
		while a[i] == '9':
			i -= 1
		b = a[0:i] + str(int(a[i]) + 1)
		b += '0' * (k - len(b))
		print(n)
		print((b * (n // k + 5))[0:n])


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
(n, k) = map(int, input().split())
a = input()
l = []
for i in range(n):
	l.append(a[i])
b = int(a)
for i in range(k, n):
	l[i] = l[i - k]
a = ''.join(l)
if int(a) >= b:
	print(len(a))
	print(a)
else:
	ind = 0
	for i in range(k - 1, -1, -1):
		if l[i] != '9':
			b = int(l[i])
			l[i] = str(b + 1)
			ind = i
			break
	for i in range(ind + 1, k):
		l[i] = '0'
	for i in range(k, n):
		l[i] = l[i - k]
	print(len(l))
	a = ''.join(l)
	print(a)


def getn(x):
	final = x
	while len(final) < n:
		final += x
	while len(final) != n:
		final.pop()
	return final
(n, k) = map(int, input().split())
x = list(map(int, list(input())))
numx = int(''.join([str(i) for i in x]))
final = getn(x[0:k])
finaln = int(''.join([str(i) for i in final]))
if finaln < numx:
	newf = int(''.join([str(i) for i in x[0:k]])) + 1
	newf = [int(a) for a in str(newf)]
	final = getn(newf)
print(len(final))
print(''.join([str(i) for i in final]))


(n, k) = map(int, input().split())
s = input()
a = s[0:k]
guess_1 = a
b = ''.join([guess_1[i % k] for i in range(n)])
if b >= s:
	ans = b
else:
	guess_2 = str(int(a) + 1)
	assert len(a) == len(guess_2)
	ans = ''.join([guess_2[i % k] for i in range(n)])
print(len(ans))
print(ans)


(n, k) = map(int, input().split())
st = input()

def makb(s):
	ls = list(s)
	for i in range(n - k):
		ls[k + i] = ls[i]
	return ''.join(ls)
st2 = makb(st)
if st2 >= st:
	print(len(st2))
	print(st2)
else:
	a = int(st2) + 10 ** (n - k)
	st3 = makb(str(a))
	print(len(st3))
	print(st3)


from fractions import gcd
from math import ceil, inf
from collections import defaultdict, Counter, deque
from bisect import bisect, insort, bisect_left, bisect_right

def isGreater(a, b):
	for i in range(len(a)):
		if a[i] > b[i]:
			return True
		if a[i] < b[i]:
			return False
	return True

def solve(n, k, num):
	temp = list(num[:k])
	ans = temp * int(ceil(n / k))
	ans = ans[:n]
	if not isGreater(ans, num):
		for i in range(k - 1, -1, -1):
			if temp[i] == '9':
				temp[i] = '0'
			else:
				temp[i] = str(int(temp[i]) + 1)
				break
		ans = temp * int(ceil(n / k))
		ans = ans[:n]
	return ''.join(ans)

def main():
	(n, k) = map(int, input().split())
	num = input()
	ans = solve(n, k, num)
	print(len(ans))
	print(ans)
main()