public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);

		System.out.println((Main.calc(s.nextInt(), s.nextInt())));
	}

	public static int calc(int k, int s) {
		int count = 0;
		for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			}
		}
		return count;
	}
} public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);

		System.out.println((Main.calc(s.nextInt(), s.nextInt())));
	}

	public static int calc(int k, int s) {
		int count = 0;
		for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			}
		}
		return count;
	}
} Main public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);

		System.out.println((Main.calc(s.nextInt(), s.nextInt())));
	} main {
		java.util.Scanner s = new java.util.Scanner(System.in);

		System.out.println((Main.calc(s.nextInt(), s.nextInt())));
	} java.util.Scanner s = new java.util.Scanner(System.in); s new java.util.Scanner(System.in) System.out.println((Main.calc(s.nextInt(), s.nextInt()))) System.out.println System.out System System.out (Main.calc(s.nextInt(), s.nextInt())) Main.calc Main s.nextInt() s.nextInt s s.nextInt() s.nextInt s String[] args args public static int calc(int k, int s) {
		int count = 0;
		for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			}
		}
		return count;
	} calc {
		int count = 0;
		for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			}
		}
		return count;
	} int count = 0; count 0 for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			}
		} 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) {
					count++;
				}
			}
		} {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			}
		} for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			} 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) {
					count++;
				}
			} {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			} int z = s - x - y; z s - x - y s - x - y s x y if (0 <= z && z <= k) {
					count++;
				} 0 <= z && z <= k 0 <= z 0 z z <= k z k {
					count++;
				} count++ count return count; count int k k int s s public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);

		System.out.println((Main.calc(s.nextInt(), s.nextInt())));
	}

	public static int calc(int k, int s) {
		int count = 0;
		for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			}
		}
		return count;
	}
} public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);

		System.out.println((Main.calc(s.nextInt(), s.nextInt())));
	}

	public static int calc(int k, int s) {
		int count = 0;
		for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			}
		}
		return count;
	}
} Main
public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);

		System.out.println((Main.calc(s.nextInt(), s.nextInt())));
	}

	public static int calc(int k, int s) {
		int count = 0;
		for (int x = 0; x <= k; x++) {
			for (int y = 0; y <= k; y++) {
				int z = s - x - y;
				if (0 <= z && z <= k) {
					count++;
				}
			}
		}
		return count;
	}
}