#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;

    for (int i=m-1;*(p+i)!='\0';i++)
    {
        cout<<*(p+i)<<"";
    }

    return 0;
}