#include <iostream>
using namespace std;

int main() {

    char str[30] = { 0 };
    cin.getline(str, sizeof(str));

    int m;
    cin >> m;

    // write your code here......
    char copystr[30]={0};
    char *p=str+m-1;//指向数组第m个元素
    char *q=copystr;
    while(*p)
    {
        *q++=*p++;
    }
    cout<<copystr<<endl;

    return 0;
}