Buggy python submission (verdict: Runtime Error):
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int[s] for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in D:
    Da.remove(i)
Da_str = [str(j) for j in Da]
 
a_1 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]
 
for i in nu:
    if i >= int(N):
        print(i)
        break

Fixed submission:
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int(s) for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in D:
    Da.remove(i)
Da_str = [str(j) for j in Da]
 
a_1 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]
 
for i in nu:
    if i >= int(N):
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int[s] for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in D:
    Da.remove(i)
Da_str = [str(j) for j in Da]
 
a_1 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]
 
 
for i in nu:
    if i >= int(N):
        print(i)
        break

Fixed submission:
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int(s) for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in D:
    Da.remove(i)
Da_str = [str(j) for j in Da]
 
a_1 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]
 
for i in nu:
    if i >= int(N):
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int[s] for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in range(len(D)):
    Da.remove(D[i])
Da_str = [str(j) for j in Da]
 
a_1 = [''.join(j) for j in itertools.product(b_st, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(b_st, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]
 
 
for i in nu:
    if i >= int(N):
        print(i)
        break

Fixed submission:
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int(s) for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in D:
    Da.remove(i)
Da_str = [str(j) for j in Da]
 
a_1 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]
 
for i in nu:
    if i >= int(N):
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int[s] for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in range(len(D)):
    Da.remove(D[i])
Da_str = [str(j) for j in Da]

a_1 = [''.join(j) for j in itertools.product(b_st, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(b_st, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]

 
for i in nu:
    if i >= N:
        print(i)
        break

Fixed submission:
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int(s) for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in D:
    Da.remove(i)
Da_str = [str(j) for j in Da]
 
a_1 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]
 
for i in nu:
    if i >= int(N):
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])

d = input().split()
D = [int[s] for s in d]

Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

for i in range(len(D)):
    Da.remove(D[i])

nu = []
for j in itertools.combinations_with_replacement(Da, len(N)+1):
    b = ''.join([str(j[i]) for i in range(len(N)+1)])
    nu.append(int(b))

for i in nu:
    if i >= N:
        print(i)
        break
  

Fixed submission:
import itertools
NK = input().split()
N = NK[0]
K = int(NK[1])
 
d = input().split()
D = [int(s) for s in d]
 
Da = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 
for i in D:
    Da.remove(i)
Da_str = [str(j) for j in Da]
 
a_1 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N))]
a_2 = [''.join(j) for j in itertools.product(Da_str, repeat=len(N)+1)]
a = a_1 + a_2
nu = [int(k) for k in a]
 
for i in nu:
    if i >= int(N):
        print(i)
        break