require 'prime' N,L = gets.chomp.split.map(&:to_i) possible_primes = Prime.each(L/(N-1)) sum = 0 possible_primes.each do |p| sum += L - p * (N-1) + 1 end puts sum