14 lines
275 B
Python
14 lines
275 B
Python
import io
|
|
import sys
|
|
|
|
# import time
|
|
|
|
sys.stdin = io.StringIO('1000000\n5')
|
|
|
|
# start = time.time()
|
|
n, m = int(input()), int(input())
|
|
nums = [i for i in range(1, n + 1)]
|
|
nums.sort(key=lambda x: sum(map(int, list(str(x)))))
|
|
print(nums[m - 1])
|
|
# print(time.time() - start) # 2s
|