a = 0 1000.times do n,k = gets.split.map(&:to_i) a += n%(k+1)==0 ? 1 : 0 end p a