function combination(input) {
	var max = parseInt(input.split(" ")[0]);
	var sum = parseInt(input.split(" ")[1]);
	var count = 0;
	if(sum <= max){
		for(var x = 0; x < sum+1; x++){
			for(var y = 0; y < sum+1-x; y++){
						count++;
			}
		}
	} else if (sum > max){
		for(var x = 0; x < max+1; x++){
			if(sum-x <= max){
				for(var y = 0; y < sum+1-x; y++){
						count++;
				}
			}else if(sum-x > max){
				for(var y = 0; y < max+1; y++){
					if(sum-x-y <= max){
						count++;
					}else if(sum-x-y > max){

					}
				}
			}
		}
	}
	console.log(count);
}

combination(require("fs").readFileSync("/dev/stdin", "utf8"));