#5592. CSES2109 子串的字典序 II

0

CSES2109 子串的字典序 II

Substring Order II

You are given a string of length n. If all of its substrings (not necessarily distinct) are ordered lexicographically, what is the kth smallest of them?

Input

The first input line has a string of length n that consists of characters a–z. The second input line has an integer k.

Output

Print the kth smallest substring in lexicographical order.

Constraints

1n1051 \le n \le 10^5

1kn(n+1)21 \le k \le \frac{n(n+1)}{2}

Example

Input

baabaa
10

Output

ab

Explanation: The 10 smallest substrings in order are a, a, a, a, aa, aa, aab, aaba, aabaa, and ab.