import sys



s = sys.stdin.readline().rstrip()

k = int(sys.stdin.readline().rstrip())

n = len(s)



def main():

    res = set()

    for l in range(n):

        for r in range(l, min(l+k, n)):

            res.add(s[l:r+1])



    return sorted(res)[k-1]



if __name__ == '__main__':

    ans = main()

    print(ans)
import sys



s, k = sys.stdin.read().split()

k = int(k)



def main():

    cand = set()

    for j in range(1, k + 1):

        for i in range(len(s) - j + 1):

            cand.add(s[i:i+j])

    print((sorted(cand)[k-1]))



if __name__ ==  '__main__':

    main()
import sys

s = sys.stdin.readline().rstrip()
k = int(sys.stdin.readline().rstrip())
n = len(s)


def main():
    res = set()
    for l in range(n):
        for r in range(l, min(l + k, n)):
            res.add(s[l : r + 1])
    return sorted(res)[k - 1]


if __name__ == "__main__":
    ans = main()
    print(ans)

import sys

s, k = sys.stdin.read().split()
k = int(k)


def main():
    cand = set()
    for j in range(1, k + 1):
        for i in range(len(s) - j + 1):
            cand.add(s[i : i + j])
    print((sorted(cand)[k - 1]))


if __name__ == "__main__":
    main()

-s = sys.stdin.readline().rstrip() -k = int(sys.stdin.readline().rstrip()) -n = len(s) +s, k = sys.stdin.read().split() +k = int(k) -    res = set() -    for l in range(n): -        for r in range(l, min(l + k, n)): -            res.add(s[l : r + 1]) -    return sorted(res)[k - 1] +    cand = set() +    for j in range(1, k + 1): +        for i in range(len(s) - j + 1): +            cand.add(s[i : i + j]) +    print((sorted(cand)[k - 1])) -    ans = main() -    print(ans) +    main()