9411: ABC208 —— E - Digit Products
[Creator : ]
Description
For how many positive integers at most $N$ is the product of the digits at most $K$?
Input
Input is given from Standard Input in the following format:
```
$N$ $K$
```
```
$N$ $K$
```
Output
Print the number of integers satisfying the condition.
Constraints
- $1 \leq N \leq 10^{18}$
- $1 \leq K \leq 10^9$
- All values in input are integers.
- $1 \leq K \leq 10^9$
- All values in input are integers.
Sample 1 Input
13 2
Sample 1 Output
5
Out of the positive integers at most 13, there are five such that the product of the digits is at most 2: 1, 2, 10, 11, and 12.
Sample 2 Input
100 80
Sample 2 Output
99
Out of the positive integers at most 100, all but 99 satisfy the condition.
Sample 3 Input
1000000000000000000 1000000000
Sample 3 Output
841103275147365677