import Foundation func readInt() -> [Int] { return readLine()!.split(separator: " ").map { c in Int(c)! } } func main() { let line = readInt() let N = line[0] let K = line[1] let S = readLine()! let front = S.prefix(K-1) var back = S.suffix(N-K+1) if (N - K) % 2 == 0 { back += front.reversed() } else { back += front } print(back) } main()