Buggy python submission (verdict: Runtime Error):
K, N = map(int, input().split())
As = map(int, input().split())
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Fixed submission:
K, N = list(map(int, input().split()))
As = list(map(int, input().split()))
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Buggy python submission (verdict: Runtime Error):
lines = input().split()
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Fixed submission:
K, N = list(map(int, input().split()))
As = list(map(int, input().split()))
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Buggy python submission (verdict: Runtime Error):
lines = input().split()
K, N = map(int, lines[0].split())
As = map(int, lines[1].split())
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Fixed submission:
K, N = list(map(int, input().split()))
As = list(map(int, input().split()))
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Buggy python submission (verdict: Runtime Error):
lines = input().split()
K, N = map(int, lines[0].strip().split())
As = map(int, lines[1].strip().split())
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))


Fixed submission:
K, N = list(map(int, input().split()))
As = list(map(int, input().split()))
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Buggy python submission (verdict: Runtime Error):
lines = map(int, input().split())
K, N = map(int, lines[0].strip().split())
As = map(int, lines[1].strip().split())
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))


Fixed submission:
K, N = list(map(int, input().split()))
As = list(map(int, input().split()))
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Buggy python submission (verdict: Runtime Error):
import sys
lines = sys.stdin.readlines()
K, N = map(int, lines[0].strip().split())
As = map(int, lines[1].strip().split())
dists = []
for base, switch in zip(As[:-1], As[1:]):
  dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Fixed submission:
K, N = list(map(int, input().split()))
As = list(map(int, input().split()))
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Buggy python submission (verdict: Runtime Error):
import sys
lines = sys.stdin.readlines()
K, N = map(int, lines[0].strip().split())
As = map(int, lines[1].strip().split())
dists = []
for idx, A in enumerate(As[:-1]):
  dists.append(A - As[idx+1])
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Fixed submission:
K, N = list(map(int, input().split()))
As = list(map(int, input().split()))
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))

Buggy python submission (verdict: Runtime Error):
import sys
lines = sys.stdin.readlines()
K, N = map(int, lines[0].strip().split())
As = map(int, lines[1].strip().split())
for idx, A in enumerate(As[:-1]):
  dists.append(A - As[idx+1])
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))


Fixed submission:
K, N = list(map(int, input().split()))
As = list(map(int, input().split()))
dists = []
for base, switch in zip(As[:-1], As[1:]):
    dists.append(switch - base)
dists.append(As[0]+(K-As[-1]))
print(K - max(dists))