N, K = gets.split.map(&:to_i) S = gets.chomp dp = Array.new(N + 1, -1) dp[N] = 0 len = Float::INFINITY (N - 1).downto(0) do |i| if i != 0 && S[i - 1] == 'x' len += 1 else if len > K - 1 dp[i] = 1 len = 0 else len += 1 end end end idx = dp.index(1) if idx puts idx else puts 0 end