Buggy python submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

def main():
    x, n = map(int, input().rstrip().split())
    if n == 0:
        print(x)
        sys.exit()
    else:
        p = list(map(int, input().rstrip().split()))
        if x > max(p):
            print(x)
            sys.exit()
        else:
            p_x = set(range(min(p), max(p)+1))
            p_temp = set(p)
            p_diff = p_x - p_temp
            p_temp = list(p_diff).sort()
            p_dir = []

        for i in range(len(p_temp)):
            p_dir.append(abs(p_temp[i] - x))
        print(p_temp[p_dir.index(min(p_dir))])
  
if __name__ == "__main__":
    main()

Fixed submission:
import sys

input = sys.stdin.readline

def main():
    x, n = map(int, input().rstrip().split())
    if n == 0:
        print(x)
        sys.exit()
    else:
        p = list(map(int, input().rstrip().split()))
        if x > max(p):
            print(x)
            sys.exit()
        else:
            p_x = set(range(102))
            p_temp = set(p)
            p_diff = p_x - p_temp
            p_temp = list(p_diff)
            p_temp = sorted(p_temp)
            p_dir = []

        for i in range(len(p_temp)):
            p_dir.append(abs(p_temp[i] - x))
        print(p_temp[p_dir.index(min(p_dir))])
  
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

def main():
    x, n = map(int, input().rstrip().split())
    if n == 0:
        print(x)
        sys.exit()
    else:
        p = list(map(int, input().rstrip().split()))
        if x > max(p):
            print(x)
            sys.exit()
        else:
            p_x = set(range(min(p),max(p)+1))
            p_temp = set(p)
            p_diff = p_x - p_temp
            p_temp = list(p_diff)
            p_dir = []

        for i in range(len(p_temp)):
            p_dir.append(abs(p_temp[i] - x))
        print(p_temp[p_dir.index(min(p_dir))])
  
if __name__ == "__main__":
    main()

Fixed submission:
import sys

input = sys.stdin.readline

def main():
    x, n = map(int, input().rstrip().split())
    if n == 0:
        print(x)
        sys.exit()
    else:
        p = list(map(int, input().rstrip().split()))
        if x > max(p):
            print(x)
            sys.exit()
        else:
            p_x = set(range(102))
            p_temp = set(p)
            p_diff = p_x - p_temp
            p_temp = list(p_diff)
            p_temp = sorted(p_temp)
            p_dir = []

        for i in range(len(p_temp)):
            p_dir.append(abs(p_temp[i] - x))
        print(p_temp[p_dir.index(min(p_dir))])
  
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline

def main():
  x, n = map(int, input().rstrip().split())
  if n == 0:
    print(x)
    sys.exit()
  else:
    p = list(map(int, input().rstrip().split()))
	if x > max(p):
      print(x)
      sys.exit()
    else:
      p_x = set(range(max(p)+1))
      p_temp = set(p)
      p_diff = p_x - p_temp
      p_temp = list(p_diff)
      p_dir = []

      for i in range(len(p_temp)):
        p_dir.append(abs(p_temp[i] - x))
      print(p_temp[p_dir.index(min(p_dir))])
  
if __name__ == "__main__":
  main()

Fixed submission:
import sys

input = sys.stdin.readline

def main():
    x, n = map(int, input().rstrip().split())
    if n == 0:
        print(x)
        sys.exit()
    else:
        p = list(map(int, input().rstrip().split()))
        if x > max(p):
            print(x)
            sys.exit()
        else:
            p_x = set(range(102))
            p_temp = set(p)
            p_diff = p_x - p_temp
            p_temp = list(p_diff)
            p_temp = sorted(p_temp)
            p_dir = []

        for i in range(len(p_temp)):
            p_dir.append(abs(p_temp[i] - x))
        print(p_temp[p_dir.index(min(p_dir))])
  
if __name__ == "__main__":
    main()