import sys input = sys.stdin.readline def calc(S): nS = [0] * (len(S)-1) for i in range(len(S)-1): nS[i] = 1 ^ (S[i] & S[i+1]) return nS N, K = map(int, input().split()) S = list(map(int, input().rstrip())) for k in range(2): if k == N-K: print("".join(map(str, S))) S = calc(S) k = N - K if k % 2 == 0: m = k // 2 - 1 else: S = calc(S) m = (k - 1) // 2 - 1 print("".join(map(str, S[m:len(S)-m])))