class Calc0106 def initialize(args) args = args.map { |l| l.chomp.split(/\s+/) } @n, @k = args.shift.map(&:to_i) end def run return @n - 1 if @k == 1 @memo = Array.new(@n + 1) { 0 } (2..(@n / 2)).each do |m| if @memo[m] == 0 m.step(@n, m) do |i| @memo[i] += 1 end end end @memo.select { |v| v >= @k }.size end end puts Calc0106.new(STDIN.readlines).run if __FILE__ == $0