Lexicographic order
Recently, the government of Ruthenia unveiled a new initiative aimed at establishing the country as a leader in the IT sector. The core objective of this project is to modernize Ruthenia's entire educational system. Naturally, Stepan heard about this and became intrigued, as he was in the process of selecting a university for his further studies.
Stepan made his decision—he is now a student at the Ruthenian National University (RNU). His life became lively and colorful: he immersed himself in the culture and traditions of the unfamiliar Ruthenia, met a girl named Marysia, and learned how to navigate life in the dormitory.
However, as you might expect, student life isn't always easy. Help Stepan tackle the challenges he faces and avoid embarrassing himself in front of Marysia by solving the problem from the class he missed while spending time with her:
We define one natural number as lexicographically smaller than another if this is true for their decimal representations. Your task is to find the k-th number in the lexicographically sorted sequence of natural numbers from 1 to N inclusive.
Input
The first line contains two integers N and k (1 ≤ k ≤ N ≤ 10^9).
Output
Output a single number—the k-th lexicographical element of the sequence of natural numbers from 1 to N.