# ABC097C - K-th Substring (ARC097C)

from functools import reduce

from operator import or_





def get_substring(a: str, x: int) -> set:

    ret = set()

    for i in range(N - x + 1):

        ret |= {a[i : i + x]}

    return ret





def main():

    global N

    S = eval(input())

    K = int(eval(input()))

    N = len(S)

    x = reduce(or_, [get_substring(S, i) for i in range(1, K + 1)])

    ans = sorted(x)[K - 1]

    print(ans)





if __name__ == "__main__":

    main()
# ABC097C - K-th Substring (ARC097C)

def get_substring(a: str, x: int) -> set:

    ret = set()

    for i in range(N - x + 1):

        ret |= {a[i : i + x]}

    return ret





def main():

    global N

    S = eval(input())

    K = int(eval(input()))

    N, x = len(S), set()

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

        x |= get_substring(S, i)

    ans = sorted(x)[K - 1]

    print(ans)





if __name__ == "__main__":

    main()
# ABC097C - K-th Substring (ARC097C)
from functools import reduce
from operator import or_


def get_substring(a: str, x: int) -> set:
    ret = set()
    for i in range(N - x + 1):
        ret |= {a[i : i + x]}
    return ret


def main():
    global N
    S = eval(input())
    K = int(eval(input()))
    N = len(S)
    x = reduce(or_, [get_substring(S, i) for i in range(1, K + 1)])
    ans = sorted(x)[K - 1]
    print(ans)


if __name__ == "__main__":
    main()

# ABC097C - K-th Substring (ARC097C)
def get_substring(a: str, x: int) -> set:
    ret = set()
    for i in range(N - x + 1):
        ret |= {a[i : i + x]}
    return ret


def main():
    global N
    S = eval(input())
    K = int(eval(input()))
    N, x = len(S), set()
    for i in range(1, K + 1):
        x |= get_substring(S, i)
    ans = sorted(x)[K - 1]
    print(ans)


if __name__ == "__main__":
    main()

-from functools import reduce -from operator import or_ - - -    N = len(S) -    x = reduce(or_, [get_substring(S, i) for i in range(1, K + 1)]) +    N, x = len(S), set() +    for i in range(1, K + 1): +        x |= get_substring(S, i)