s,k=input(),int(input())print(s[-k:]+s[:-k])
apple 2
leapp
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!