while True:
try:
string = input()
number = int(input())
print(string[:number])
except:
break
while True:
try:
string = input()
number = int(input())
print(string[:number])
except:
break