Time limit
2s
Memory limit
128 MB
Suyeong found N gems arranged in a line inside an ancient ruin. The value of each gem is given. She moves only from left to right, and at each position she may either take that gem or pass it.
She can choose a taking interval only once. Once she starts taking gems, she must take consecutive gems including that position, and she must take at least M gems. After she stops, she cannot start taking gems again. In other words, she must choose one contiguous subarray whose length is at least M.
Because carrying too many gems can be heavy, Suyeong wants to maximize the average value of the gems she takes. Find the maximum possible average value under these rules.
The first line contains two integers N and M.
Each of the next N lines contains the value of one gem in order. Every gem value is an integer between 0 and 2,000, inclusive.
Print one integer: the maximum possible average value multiplied by 1,000.
To avoid rounding issues, use integer arithmetic. For a chosen interval with total value S and length L, consider the integer value of 1000*S/L, and print the maximum such value.