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

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""

ans = 10**100

print(x[idx])

print(ans)
exit()

for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

print(ans)

Fixed submission:
import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

if idx == n:
    ans = -x[-k]

print(ans)

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

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""

ans = 10**100

if x[idx] == 0:
    print(ans)

print(ans)
exit()

for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

print(ans)

Fixed submission:
import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

if idx == n:
    ans = -x[-k]

print(ans)

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

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""

ans = 10**100

if x[idx] == 0 and idx - k + 1 >= 0:
    print(ans)

print(ans)
exit()

for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

print(ans)

Fixed submission:
import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

if idx == n:
    ans = -x[-k]

print(ans)

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

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""

ans = 10**100

if x[idx] == 0 and idx - k + 1 >= 0:
    ans = min(ans,ans)

print(ans)
exit()

for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

print(ans)

Fixed submission:
import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

if idx == n:
    ans = -x[-k]

print(ans)

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

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""

ans = 10**100

if x[idx] == 0 and idx - k + 1 >= 0:
    ans = min(ans,-x[0])

print(ans)
exit()

for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

print(ans)

Fixed submission:
import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

if idx == n:
    ans = -x[-k]

print(ans)

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

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""

ans = 10**100

if x[idx] == 0 and idx - k + 1 >= 0:
    ans = min(ans,-x[idx-k+1])

print(ans)
exit()

for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

print(ans)

Fixed submission:
import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

if idx == n:
    ans = -x[-k]

print(ans)

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

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""

ans = 10**100

if x[idx] == 0 and idx - k + 1 >= 0:
    ans = min(ans,-x[idx-k+1])


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

print(ans)

Fixed submission:
import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

if idx == n:
    ans = -x[-k]

print(ans)

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

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100

for i in range(k+1):
    if x[idx] == 0 and idx - k + 1 > 0:
        ans = min(ans,x[idx-k+1])
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

print(ans)

Fixed submission:
import bisect

n,k= map(int,input().split())
x = [int(i) for i in input().split()]

idx = bisect.bisect_left(x,0)
"""
if x[idx] == 0:
    x.insert(idx,0)
"""
ans = 10**100


for i in range(k+1):
    #print(idx-i,idx+k-1-i)
    if i == 0 and idx+k-1 < n:
        ans = min(ans, x[idx+k-1])
    elif idx - i < 0 or idx+k-1-i >= n:
        continue
    else:
        ans = min(ans, - 2*x[idx-i] + x[idx+k-1-i])
        ans = min(ans, - x[idx-i] + 2*x[idx+k-1-i])

if idx == n:
    ans = -x[-k]

print(ans)