import java.util.*;
public class Main {
	public static void main(String[] atgs) {
		Scanner scan = new Scanner(System.in);
		int ans = 0;
		int K = scan.nextInt();
		int S = scan.nextInt();
		for(int x = 0; x <= K; x++){
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    }
		System.out.println(ans);
		scan.close();
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] atgs) {
		Scanner scan = new Scanner(System.in);
		int ans = 0;
		int K = scan.nextInt();
		int S = scan.nextInt();
		for(int x = 0; x <= K; x++){
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    }
		System.out.println(ans);
		scan.close();
	}
} Main public static void main(String[] atgs) {
		Scanner scan = new Scanner(System.in);
		int ans = 0;
		int K = scan.nextInt();
		int S = scan.nextInt();
		for(int x = 0; x <= K; x++){
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    }
		System.out.println(ans);
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		int ans = 0;
		int K = scan.nextInt();
		int S = scan.nextInt();
		for(int x = 0; x <= K; x++){
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    }
		System.out.println(ans);
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int ans = 0; ans 0 int K = scan.nextInt(); K scan.nextInt() scan.nextInt scan int S = scan.nextInt(); S scan.nextInt() scan.nextInt scan for(int x = 0; x <= K; x++){
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    } int x = 0; int x = 0; x 0 x <= K x K x++ x++ x {
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    } {
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    } for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			} int y = 0; int y = 0; y 0 y <= K y K y++ y++ y {
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			} {
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			} int z = S - x - y; z S - x - y S - x - y S x y if(0 <= z && z <= K){
					ans = ans + 1;
				} 0 <= z && z <= K 0 <= z 0 z z <= K z K {
					ans = ans + 1;
				} ans = ans + 1 ans ans + 1 ans 1 System.out.println(ans) System.out.println System.out System System.out ans scan.close() scan.close scan String[] atgs atgs public class Main {
	public static void main(String[] atgs) {
		Scanner scan = new Scanner(System.in);
		int ans = 0;
		int K = scan.nextInt();
		int S = scan.nextInt();
		for(int x = 0; x <= K; x++){
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    }
		System.out.println(ans);
		scan.close();
	}
} public class Main {
	public static void main(String[] atgs) {
		Scanner scan = new Scanner(System.in);
		int ans = 0;
		int K = scan.nextInt();
		int S = scan.nextInt();
		for(int x = 0; x <= K; x++){
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    }
		System.out.println(ans);
		scan.close();
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] atgs) {
		Scanner scan = new Scanner(System.in);
		int ans = 0;
		int K = scan.nextInt();
		int S = scan.nextInt();
		for(int x = 0; x <= K; x++){
			for(int y = 0; y <= K; y++){
				int z = S - x - y;
				if(0 <= z && z <= K){
					ans = ans + 1;
				}
			}
	    }
		System.out.println(ans);
		scan.close();
	}
}
