Time limit
2s
Memory limit
128 MB
Consider a list of nonnegative numbers. If the sum of all numbers in the list is S and their product is P, call the list valid.
Given S and P, find the minimum possible size of a valid list. The size of a list is the number of numbers it contains. If no such list exists, print -1.
The numbers in the list are not required to be integers.
The first line contains two natural numbers S and P, separated by a space. Each number is at most 1,000,000,000.
Print the answer on the first line.