#include <stdio.h>

int main() {

    char str[30] = { 0 };
    gets(str);

    int m;
    scanf("%d",&m);

    // write your code here......
    char dst[30];
   char* temp_str=str+m-1;
   char* temp_dst=dst;
    while(*temp_dst++ = *temp_str++); //鹏哥nb的代码
    printf("%s",dst);
    return 0;
}