import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, x;
		int sum = 0;
		int[] count = new int[300];
		int index;
		for (index = 0; true; index++) {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			}
		}
		for (int i = 0; i < index; i++) {
			System.out.println(count[i]);
		}
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, x;
		int sum = 0;
		int[] count = new int[300];
		int index;
		for (index = 0; true; index++) {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			}
		}
		for (int i = 0; i < index; i++) {
			System.out.println(count[i]);
		}
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, x;
		int sum = 0;
		int[] count = new int[300];
		int index;
		for (index = 0; true; index++) {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			}
		}
		for (int i = 0; i < index; i++) {
			System.out.println(count[i]);
		}
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n, x;
		int sum = 0;
		int[] count = new int[300];
		int index;
		for (index = 0; true; index++) {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			}
		}
		for (int i = 0; i < index; i++) {
			System.out.println(count[i]);
		}
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n x; x int sum = 0; sum 0 int[] count = new int[300]; count new int[300] 300 int index; index for (index = 0; true; index++) {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			}
		} index = 0; index = 0 index 0 true index++ index++ index {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			}
		} {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			}
		} n = sc.nextInt() n sc.nextInt() sc.nextInt sc x = sc.nextInt() x sc.nextInt() sc.nextInt sc if (n == 0 && x == 0) {
				break;
			} n == 0 && x == 0 n == 0 n 0 x == 0 x 0 {
				break;
			} break; for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			} {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			} sum += i sum i for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				} int j = i + 1; int j = i + 1; j i + 1 i 1 j <= n j n j++ j++ j {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				} {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				} sum += j sum j for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					} int k = j + 1; int k = j + 1; k j + 1 j 1 k <= n k n k++ k++ k {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					} {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					} sum += k sum k if (sum == x) {
							count[index]++;
						} sum == x sum x {
							count[index]++;
						} count[index]++ count[index] count index sum -= k sum k sum -= j sum j sum -= i sum i for (int i = 0; i < index; i++) {
			System.out.println(count[i]);
		} int i = 0; int i = 0; i 0 i < index i index i++ i++ i {
			System.out.println(count[i]);
		} {
			System.out.println(count[i]);
		} System.out.println(count[i]) System.out.println System.out System System.out count[i] count i sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, x;
		int sum = 0;
		int[] count = new int[300];
		int index;
		for (index = 0; true; index++) {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			}
		}
		for (int i = 0; i < index; i++) {
			System.out.println(count[i]);
		}
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, x;
		int sum = 0;
		int[] count = new int[300];
		int index;
		for (index = 0; true; index++) {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			}
		}
		for (int i = 0; i < index; i++) {
			System.out.println(count[i]);
		}
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, x;
		int sum = 0;
		int[] count = new int[300];
		int index;
		for (index = 0; true; index++) {
			n = sc.nextInt();
			x = sc.nextInt();
			if (n == 0 && x == 0) {
				break;
			}
			for (int i = 1; i < n; i++) {
				sum += i;
				for (int j = i + 1; j <= n; j++) {
					sum += j;
					for (int k = j + 1; k <= n; k++) {
						sum += k;
						if (sum == x) {
							count[index]++;
						}
						sum -= k;
					}
					sum -= j;
				}
				sum -= i;
			}
		}
		for (int i = 0; i < index; i++) {
			System.out.println(count[i]);
		}
		sc.close();
	}
}
