# -*- coding: utf-8 -*-
while True:
    try:
        str_n = raw_input()#获得字符串
        k = int(input())#获得k
        srt_out = []
        for x in range(k):
            srt_out.append(str_n[x])
        print(str(srt_out).replace("[","").replace("]","").replace(",","").replace("'", "").replace(" ", ""))#将列表转化为字符串
    except:
        break