# 初期入力
A,B = (int(x) for x in input().split())

#
sukima =A-B*2
if 0 < sukima:
    print(sukima)
else:
    print(0) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A,B = (int(x) for x in input().split()) A (int(x) for x in input().split()) B sukima =A-B*2 sukima A-B*2 A B*2 B 2 if 0 < sukima:
    print(sukima)
else:
    print(0) 0 < sukima 0 sukima print(sukima) print sukima print(0) print 0 B = (int(x) for x in input().split()) (int(x) for x in input().split()) B A,B = (int(x) for x in input().split()) (int(x) for x in input().split()) A sukima =A-B*2 A-B*2 sukima
# 初期入力
A,B = (int(x) for x in input().split())

#
sukima =A-B*2
if 0 < sukima:
    print(sukima)
else:
    print(0)