n,k=gets.split.map(&:to_i) s=gets.chomp (0..(n-k)).each do |index| firstWord = index == 0 ? "" : s[0...index] reverseWord = s[index...(k+index)].reverse endWord = (k+index) == n ? "" : s[(k+index)...n] s = firstWord + reverseWord + endWord end puts s