Arad Eating Sushi
Arad loves eating sushi, but only after 4:00 PM, when it is cheaper. However, a certain capybara knows this and wants to steal Arad's sushi.
Each day, Arad buys sushi at exactly one of possible times:
minutes after 4:00 PM. The capybara knows the probability distribution of the time at which Arad buys sushi.
The capybara can stand outside the sushi shop for one contiguous window of time. If it waits for minutes starting at minute
, it will catch Arad if he buys sushi at any of the minutes
.
The capybara wants at least an percent chance of stealing Arad's sushi. Since it is very lazy, find the minimum number of minutes it must wait.
Input
The first line contains two integers and
(
,
): the number of possible purchase times and the required percentage chance of success.
The second line contains integers
(
), where
is the probability weight for minute
. At least one weight is positive.
The probability that Arad buys sushi at minute is
Output
Output a single integer: the minimum number of minutes the capybara must stand outside the sushi shop to have at least an percent chance of stealing Arad's sushi.
Examples
Input 1
10 50
1 2 3 2 3 5 7 9 2 2
Output 1
3
The capybara can wait for minutes starting at 4:05 PM. The probability of success is
, which is at least
.
Input 2
10 100
1 2 3 2 3 5 7 9 2 2
Output 2
10
Since every possible purchase time has positive weight, the capybara must wait for all minutes to guarantee a
chance of stealing the sushi.
Comments