def digit(x,i):
    return x[-int(i):]

x,i = input().split()
print(digit(x,i))