#include <stdio.h>
void shiftLeft(char str[], int count)
{
int i;
char temp[120];
char* s1, *s2;
for (i = 0; i < count; ++i){
temp[i] = str[i];
}
s1 = str + count;
s2 = str;
while (*s2 = *s1){ ++s2; ++s1; };
for (i = 0; i < count; ++i){
*s2++ = temp[i];
}
*s2 = 0;
}
int main()
{
int count = 2;
char str1[100] = { "" };
char str2[20][100];
gets(str1);
scanf("%d",&count);
shiftLeft(str1, count);
printf("%s\n", str1);
return 0;
}