#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  int c;
  int e;
  cin >> a >> b;
  c = b * 2;
  e = a - c;
  if (c >= a) {
    cout << 0;
  }
  if (a > c) {
    cout << e;
  }
  return 0;
}
