
A single line containing two space-separated integers, 'N' and 'K'.
Print a single digit (0-9) which is the K-th digit of the N-th palindrome.
If 'K' is greater than the number of digits in the N-th palindrome, print -1.
The indexing for both 'N' and 'K' is 1-based.
The 1st palindrome is 1, the 9th is 9, the 10th is 11.
The expected time complexity is O(log N)