import sys

from collections import defaultdict, deque, Counter

import math



# import copy

from bisect import bisect_left, bisect_right

# import heapq



# sys.setrecursionlimit(1000000)



# input aliases

input = sys.stdin.readline



getS = lambda: input().strip()

getN = lambda: int(eval(input()))

getList = lambda: list(map(int, input().split()))

getZList = lambda: [int(x) - 1 for x in input().split()]



INF = 10 ** 20

MOD = 10**9 + 7

divide = lambda x: pow(x, MOD-2, MOD)





def nck(n, k, kaijyo):

    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD





def npk(n, k, kaijyo):

    if k == 0 or k == n:

        return n % MOD

    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD





def kaijyo(n):

    ret = [1]

    for i in range(1, n + 1):

        ret.append((ret[-1] * i)% MOD)

    return ret





def solve():

    S = getS()

    k = getN()





    li = []

    for i in range(len(S)):

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

            if i + j > len(S):

                continue

            li.append(S[i:i+j])



    li = list(set(li))

    li.sort()

    print((li[k-1]))

    # print(li)





def main():

    n = getN()

    for _ in range(n):

        solve()





if __name__ == "__main__":

    # main()

    solve()
import sys

import math

import copy

from heapq import heappush, heappop, heapify

from functools import cmp_to_key

from bisect import bisect_left, bisect_right

from collections import defaultdict, deque, Counter

# sys.setrecursionlimit(1000000)



# input aliases

input = sys.stdin.readline

getS = lambda: input().strip()

getN = lambda: int(eval(input()))

getList = lambda: list(map(int, input().split()))

getZList = lambda: [int(x) - 1 for x in input().split()]



INF = float("inf")

MOD = 10**9 + 7

divide = lambda x: pow(x, MOD-2, MOD)



def solve():

    s = getS()

    k = getN()



    ss = set()

    for i in range(len(s)):

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

            if i + j <= len(s):

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



    ss = list(ss)

    ss.sort()

    # ss.sort(key=lambda x:len(x))

    # print(ss)

    print((ss[k-1]))





def main():

    n = getN()

    for _ in range(n):

        solve()



    return

if __name__ == "__main__":

    # main()

    solve()











import sys
from collections import defaultdict, deque, Counter
import math

# import copy
from bisect import bisect_left, bisect_right

# import heapq
# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]
INF = 10**20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n - k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i) % MOD)
    return ret


def solve():
    S = getS()
    k = getN()
    li = []
    for i in range(len(S)):
        for j in range(1, k + 1):
            if i + j > len(S):
                continue
            li.append(S[i : i + j])
    li = list(set(li))
    li.sort()
    print((li[k - 1]))
    # print(li)


def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    # main()
    solve()

import sys
import math
import copy
from heapq import heappush, heappop, heapify
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter

# sys.setrecursionlimit(1000000)
# input aliases
input = sys.stdin.readline
getS = lambda: input().strip()
getN = lambda: int(eval(input()))
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]
INF = float("inf")
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)


def solve():
    s = getS()
    k = getN()
    ss = set()
    for i in range(len(s)):
        for j in range(1, k + 1):
            if i + j <= len(s):
                ss.add(s[i : i + j])
    ss = list(ss)
    ss.sort()
    # ss.sort(key=lambda x:len(x))
    # print(ss)
    print((ss[k - 1]))


def main():
    n = getN()
    for _ in range(n):
        solve()
    return


if __name__ == "__main__":
    # main()
    solve()

+import math +import copy +from heapq import heappush, heappop, heapify +from functools import cmp_to_key +from bisect import bisect_left, bisect_right -import math -# import copy -from bisect import bisect_left, bisect_right - -# import heapq -INF = 10**20 +INF = float("inf") -def nck(n, k, kaijyo): -    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD - - -def npk(n, k, kaijyo): -    if k == 0 or k == n: -        return n % MOD -    return (kaijyo[n] * divide(kaijyo[n - k])) % MOD - - -def kaijyo(n): -    ret = [1] -    for i in range(1, n + 1): -        ret.append((ret[-1] * i) % MOD) -    return ret - - -    S = getS() +    s = getS() -    li = [] -    for i in range(len(S)): +    ss = set() +    for i in range(len(s)): -            if i + j > len(S): -                continue -            li.append(S[i : i + j]) -    li = list(set(li)) -    li.sort() -    print((li[k - 1])) -    # print(li) +            if i + j <= len(s): +                ss.add(s[i : i + j]) +    ss = list(ss) +    ss.sort() +    # ss.sort(key=lambda x:len(x)) +    # print(ss) +    print((ss[k - 1])) +    return