public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		// Scanner scan = new Scanner(System.in);
		StringBuilder out = new StringBuilder();
		String line;
		int dp[][] = new int[13][13];
		/*
		 * dp[1][11] = 1; dp[2][10] = 11; dp[3][9] = 30; dp[4][8] = 285;
		 * dp[5][7] = 1599; dp[6][6] = 9058; dp[7][5] = 32900; dp[8][4] = 73558;
		 * dp[9][3] = 74002; dp[10][2] = 22159; dp[11][1] = 657; dp[12][0] = 1;
		 */
		/*
		 * dp[11][0] = 1; dp[10][1] = 290; dp[9][2] = 5228; dp[8][3] = 13023;
		 * dp[7][4] = 10011; dp[6][5] = 4029; dp[5][6] = 920; dp[4][7] = 204;
		 * dp[3][8] = 25; dp[2][9] = 10; dp[1][10] = 1;
		 */

		/*
		 * for (int i = 0; i < 12; i++) { for (int j = 0; j < 12; j++) { if (i +
		 * j < 12) { k = j; res = 0; arr = new int[i]; arbol = new Tree(); for
		 * (int l = 0; l < arr.length; l++) { arr[l] = Integer.MIN_VALUE; }
		 * dfs(arr, 0, 0); dp[i][j] = res; } } }
		 */

		/*
		 * for (int i = 0; i < dp.length; i++) { for (int j = 0; j < dp.length;
		 * j++) { System.out.print(dp[i][j] + " "); } System.out.println(); }
		 */

		for (int i = 1; i <= dp.length; i++) {
			for (int j = 0; j <= 12; j++) {
				if (i + j <= 12)
					System.out.println(i + " " + j);
			}
		}

		int t = 0;
		while ((line = in.readLine()) != null && !line.equals("")) {

			// while (scan.hasNext()) {
			if (t++ > 0)
				out.append("\n");
			int c[] = atoi(line);
			int n = c[0];
			k = c[1];

			if (n == 0 && k == 0)
				break;
			// k = j;
			res = 0;
			arr = new int[n];
			arbol = new Tree();
			for (int l = 0; l < arr.length; l++) {
				arr[l] = Integer.MIN_VALUE;
			}
			r = "";
			dfs(arr, 0, 0);
			dp[n][k] = res;
			System.out.println(dp[n][k]);
			// out.append(dp[n][k] + "\n");
			// out.append(r);
			// out.append(n+" "+k+"  "+dp[n][k] + "\n");
			// System.out.println(dp[n][k]);

		}

		System.out.print(out);
		// out.deleteCharAt(out.length() - 1);
		// System.out.print(out);

	}