h, a = gets.chomp.split.map{|e| e.to_i} cnt = 0 s = [h] loop do cnt += 1 x = s[0] / a s.shift s << x s << x s.delete(0) if s.length == 0 break end end puts cnt