K-th Substring

Sort every substring of S lexicographically and print the K-th one, or -1 if there are fewer than K substrings.

Medium7StringSortingBinary searchNo attempts yetTime limit2sMemory limit512 MB

Problem

A substring of SS is the string you get by cutting one contiguous block of characters out of SS. Two cuts at different places count as two substrings even when the text is the same, so a string of length nn has n(n+1)2\frac{n(n+1)}{2} substrings in total.

Sort all substrings of SS in lexicographic order and find the KK-th one.

Input

The first line contains the string SS. It consists of lowercase letters only, and its length is between 11 and 100,000100{,}000.

The second line contains the integer KK (1K100,0001 \le K \le 100{,}000).

Output

Print the substring of SS that comes KK-th in lexicographic order. If SS has fewer than KK substrings, print 1-1.