require"prime" n,l=gets.split.map &:to_i puts Prime.each(l/(n-1)).map{|v|l-(n-1)*v+1}.inject 0,:+