#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 *p = str + m -1;
    char str2[30] = {0};
    int len = 0;
    while (*p != '\0')
    {
        str2[len++] = *p;
        p++;
    }
    cout << str2;

    return 0;
}