from collections import Counter





def solve(string):

    s, k = string.split()

    k = int(k)

    count = Counter(s)

    chars = sorted(set(s))

    for t in range(min(3, len(chars))):

        tmp = []

        i = s.index(chars[t])

        tmp.append(s[i:i + k])

        if count[chars[t]] > 1:

            for _ in range(count[chars[t]] - 1):

                i = s.index(chars[t], i + 1)

                tmp.append(s[i:i + k])

        g = []

        for p in tmp:

            for j in range(1, len(p) + 1):

                g.append(p[:j])

        g = sorted(set(g))

        if len(g) < k:

            k -= len(g)

            continue

        return g[k - 1]





if __name__ == '__main__':

    print((solve('\n'.join([eval(input()), eval(input())]))))

def solve(string):

    s, k = string.split()

    k = int(k)

    chars = sorted(set(s))

    exists = []



    def dfs(base):

        exists.append(base)

        if len(exists) >= k:

            return

        for c in chars:

            if base + c in s:

                dfs(base + c)



    for c in chars:

        dfs(c)



    return exists[k - 1]





if __name__ == '__main__':

    print((solve('\n'.join([eval(input()), eval(input())]))))

from collections import Counter


def solve(string):
    s, k = string.split()
    k = int(k)
    count = Counter(s)
    chars = sorted(set(s))
    for t in range(min(3, len(chars))):
        tmp = []
        i = s.index(chars[t])
        tmp.append(s[i : i + k])
        if count[chars[t]] > 1:
            for _ in range(count[chars[t]] - 1):
                i = s.index(chars[t], i + 1)
                tmp.append(s[i : i + k])
        g = []
        for p in tmp:
            for j in range(1, len(p) + 1):
                g.append(p[:j])
        g = sorted(set(g))
        if len(g) < k:
            k -= len(g)
            continue
        return g[k - 1]


if __name__ == "__main__":
    print((solve("\n".join([eval(input()), eval(input())]))))

def solve(string):
    s, k = string.split()
    k = int(k)
    chars = sorted(set(s))
    exists = []

    def dfs(base):
        exists.append(base)
        if len(exists) >= k:
            return
        for c in chars:
            if base + c in s:
                dfs(base + c)

    for c in chars:
        dfs(c)
    return exists[k - 1]


if __name__ == "__main__":
    print((solve("\n".join([eval(input()), eval(input())]))))

-from collections import Counter - - -    count = Counter(s) -    for t in range(min(3, len(chars))): -        tmp = [] -        i = s.index(chars[t]) -        tmp.append(s[i : i + k]) -        if count[chars[t]] > 1: -            for _ in range(count[chars[t]] - 1): -                i = s.index(chars[t], i + 1) -                tmp.append(s[i : i + k]) -        g = [] -        for p in tmp: -            for j in range(1, len(p) + 1): -                g.append(p[:j]) -        g = sorted(set(g)) -        if len(g) < k: -            k -= len(g) -            continue -        return g[k - 1] +    exists = [] + +    def dfs(base): +        exists.append(base) +        if len(exists) >= k: +            return +        for c in chars: +            if base + c in s: +                dfs(base + c) + +    for c in chars: +        dfs(c) +    return exists[k - 1]