N, K = gets.split.map(&:to_i) S = gets.chomp 0.upto(N - K) do |i| j = i + K - 1 while i < j S[i], S[j] = S[j], S[i] i += 1 j -= 1 end end puts S