import java.util.Scanner; public class Main { @SuppressWarnings("resource") public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int n=scanner.nextInt(); int d=scanner.nextInt(); int max=Integer.MIN_VALUE; int a=0; int b=0; int c=0; for(int i=0;i<=n;i++) { for(int j=0;i+j<=n;j++) { int k=n-i-j; if(i*0+j*1+k*2==d) { if(max