require 'prime' N, L = gets.split.map(&:to_i) ans = 0 Prime.each(L) do |l| a = L - l * (N - 1) + 1 break if a <= 0 ans += a end puts ans