a,b = map(int,input().split())

ans = a - b *2
if(ans < 0):
  print(0)
  exit()
print(ans) a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b ans = a - b *2 ans a - b *2 a b *2 b 2 if(ans < 0):
  print(0)
  exit() ans < 0 ans 0 print(0) print 0 exit() exit print(ans) print ans ans = a - b *2 a - b *2 ans a,b = map(int,input().split()) map(int,input().split()) a b = map(int,input().split()) map(int,input().split()) b
a,b = map(int,input().split())

ans = a - b *2
if(ans < 0):
  print(0)
  exit()
print(ans)