
def comb1(n, x)
    if n<x || x <= 0
    return 0
  else
    @cnt += 1
  end
end

def comb2(n, x)
  for i in 1..(n-1)
    comb1(i, x-i-1)
  end
end

def comb3(n, x)
  for i in 1..(n-1)
    comb2(i, x-i-1)
  end

end

input_values = []

while true
  input_value  = gets.chomp.split.map(&:to_i)
  if input_value == [0, 0]
    break
  end
  input_values.push(input_value)
end

length = input_values.length
answers = []

for i in 0..(length-1)
  n = input_values[i][0]
  x = input_values[i][1]
  @cnt = 0
  comb3(n, x)
  answers.push(@cnt)
end

for i in 0..(length-1)
  puts answers[i]
end