Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)


def 関数(x, n, p_liste):
    if n == 0:
        return x
    
    if x not in p_liste:
        return x
    chikai = x-1
    plus = x + 1

    for _ in range(n/2+4):
        #print(p_liste)
        if chikai not in p_liste:
            return chikai
        elif plus not in p_liste:
            return plus
        else: 
            plus += 1
            chikai -= 1
    return "問題"

def çözmek():
    X,N = map(int,sys.stdin.readline().split())
    P_liste = list(map(int, sys.stdin.readline().split()))

   
    res = []
    res.append(関数(X,N,P_liste))
    print(*res, sep="\n")

if __name__ == "__main__":
    çözmek()


Fixed submission:
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)


def 関数(x, n, p_liste):
    if n == 0:
        return x
    
    if x not in p_liste:
        return x
    chikai = x-1
    plus = x + 1

    for _ in range(0,101):
        #print(p_liste)
        if chikai not in p_liste:
            return chikai
        elif plus not in p_liste:
            return plus
        else: 
            plus += 1
            chikai -= 1
    return "問題"

def çözmek():
    X,N = map(int,sys.stdin.readline().split())
    P_liste = list(map(int, sys.stdin.readline().split()))

   
    res = []
    res.append(関数(X,N,P_liste))
    print(*res, sep="\n")

if __name__ == "__main__":
    çözmek()

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)


def 関数(x, n, p_liste):
    if n == 0:
        return x
    
    if x not in p_liste:
        return x
    chikai = x-1
    plus = x + 1

    for _ in range(n/2+1):
        #print(p_liste)
        if chikai not in p_liste:
            return chikai
        elif plus not in p_liste:
            return plus
        else: 
            plus += 1
            chikai -= 1
    return "問題"

def çözmek():
    X,N = map(int,sys.stdin.readline().split())
    P_liste = list(map(int, sys.stdin.readline().split()))

   
    res = []
    res.append(関数(X,N,P_liste))
    print(*res, sep="\n")

if __name__ == "__main__":
    çözmek()


Fixed submission:
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)


def 関数(x, n, p_liste):
    if n == 0:
        return x
    
    if x not in p_liste:
        return x
    chikai = x-1
    plus = x + 1

    for _ in range(0,101):
        #print(p_liste)
        if chikai not in p_liste:
            return chikai
        elif plus not in p_liste:
            return plus
        else: 
            plus += 1
            chikai -= 1
    return "問題"

def çözmek():
    X,N = map(int,sys.stdin.readline().split())
    P_liste = list(map(int, sys.stdin.readline().split()))

   
    res = []
    res.append(関数(X,N,P_liste))
    print(*res, sep="\n")

if __name__ == "__main__":
    çözmek()