import 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 X,Y = 0,Z;
		int sum = 0;
		for(Z=0;Z<=K;Z++){
			S -= Z;
			for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			}
			S += Z;
		}
		System.out.println(sum);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int X,Y = 0,Z;
		int sum = 0;
		for(Z=0;Z<=K;Z++){
			S -= Z;
			for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			}
			S += Z;
		}
		System.out.println(sum);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int X,Y = 0,Z;
		int sum = 0;
		for(Z=0;Z<=K;Z++){
			S -= Z;
			for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			}
			S += Z;
		}
		System.out.println(sum);
	} main {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int X,Y = 0,Z;
		int sum = 0;
		for(Z=0;Z<=K;Z++){
			S -= Z;
			for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			}
			S += Z;
		}
		System.out.println(sum);
	} 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 X X Y = 0 Y 0 Z; Z int sum = 0; sum 0 for(Z=0;Z<=K;Z++){
			S -= Z;
			for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			}
			S += Z;
		} Z=0; Z=0 Z 0 Z<=K Z K Z++ Z++ Z {
			S -= Z;
			for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			}
			S += Z;
		} {
			S -= Z;
			for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			}
			S += Z;
		} S -= Z S Z for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			} X=0; X=0 X 0 X<=K&&X<=S X<=K X K X<=S X S X++ X++ X {
				Y = S - X;
				if(Y>K)continue;
				sum++;
			} {
				Y = S - X;
				if(Y>K)continue;
				sum++;
			} Y = S - X Y S - X S X if(Y>K)continue; Y>K Y K continue; sum++ sum S += Z S Z System.out.println(sum) System.out.println System.out System System.out sum 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 X,Y = 0,Z;
		int sum = 0;
		for(Z=0;Z<=K;Z++){
			S -= Z;
			for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			}
			S += Z;
		}
		System.out.println(sum);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int S = sc.nextInt();
		int X,Y = 0,Z;
		int sum = 0;
		for(Z=0;Z<=K;Z++){
			S -= Z;
			for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			}
			S += Z;
		}
		System.out.println(sum);
	}
} Main
import 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 X,Y = 0,Z;
		int sum = 0;
		for(Z=0;Z<=K;Z++){
			S -= Z;
			for(X=0;X<=K&&X<=S;X++){
				Y = S - X;
				if(Y>K)continue;
				sum++;
			}
			S += Z;
		}
		System.out.println(sum);
	}
}