require 'prime' n, l = gets.strip.split(' ').map(&:to_i) d_max = l / (n - 1) count = 0 if d_max >= 2 count += l - 2 * (n - 1) + 1 end i = 3 while i <= d_max count += l - i * (n - 1) + 1 if i.prime? i += 2 end p count