datas = $stdin.read.split("\n")
n = datas[0].split(" ")[0].to_i
k = datas[0].split(" ")[1].to_i
datas = datas[1].split(" ")
datas.map! do |x|
	x.to_i
end
mod = datas.index(1) % k
puts ( n - mod ) /  k + mod