object Main {
  def main(args: Array[String]): Unit = {
    val scanner = new java.util.Scanner(System.in)

    while(true) {
      val n, x = scanner.nextInt
      if(n == 0 && x == 0) System.exit(0)
      println(search(n, x).filter(t => t._1.length == 3 && t._2 == x))
    }
  }

  def search(n: Int, x: Int): List[(List[Int], Int)] = {
    if(n == 1) {
      List((List(1), 1), (Nil, 0))
    } else {
      val l = search(n - 1, x)
      l.filter(_._1.length <= 3) ++ l.filter(t => t._1.length <= 2 && t._2 + n <= x).map(t => (n :: t._1, n + t._2))
    }
  }
}
