import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int ans = 0;
		for(int X=0;X<=Math.min(K, S);X++){
			for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int ans = 0;
		for(int X=0;X<=Math.min(K, S);X++){
			for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int ans = 0;
		for(int X=0;X<=Math.min(K, S);X++){
			for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int ans = 0;
		for(int X=0;X<=Math.min(K, S);X++){
			for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc int S = sc.nextInt(); S sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for(int X=0;X<=Math.min(K, S);X++){
			for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			}
		} int X=0; int X=0; X 0 X<=Math.min(K, S) X Math.min(K, S) Math.min Math K S X++ X++ X {
			for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			}
		} {
			for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			}
		} for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			} int Y=0; int Y=0; Y 0 Y<=Math.min(K, S-X) Y Math.min(K, S-X) Math.min Math K S-X S X Y++ Y++ Y {
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			} {
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			} int Z = S-X-Y; Z S-X-Y S-X-Y S X Y if(0<=Z && Z<=K){
					ans++;
				} 0<=Z && Z<=K 0<=Z 0 Z Z<=K Z K {
					ans++;
				} ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int ans = 0;
		for(int X=0;X<=Math.min(K, S);X++){
			for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int ans = 0;
		for(int X=0;X<=Math.min(K, S);X++){
			for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int ans = 0;
		for(int X=0;X<=Math.min(K, S);X++){
			for(int Y=0;Y<=Math.min(K, S-X);Y++){
				int Z = S-X-Y;
				if(0<=Z && Z<=K){
					ans++;
				}
			}
		}
		System.out.println(ans);
	}
}
