N, X = gets.chomp.split.map(&:to_i)
BAN = 0
PAT = 1

def n_1bargar(bargar, num)
  return if bargar.inject{|sum, i| sum + i} >= X

  if num == 0
    bargar[PAT] += 1
  else
    bargar[BAN] += 1
    n_1bargar(bargar, num - 1)
    bargar[PAT] += 1
    n_1bargar(bargar, num - 1)
    bargar[BAN] += 1

  end
end
bargar = [0, 0]
n_1bargar(bargar, N)
p bargar
puts bargar[PAT]
