Pond Cascade

Given pond capacities and a common fill rate, compute the exact times when the lowest pond begins to overflow and when every pond is full.

Medium6SimulationMathPrefix sumNo attempts yetTime limit2sMemory limit512 MB

Problem

A cascade of water slides has been installed in the park and it has to be tested. The cascade consists of some number of reservoirs, or ponds for short, which are linked into a single sequence connected by water slides. Visitors start the journey in the topmost pond, are then washed into subsequent lower ponds, and finally end the journey in the last pond of the cascade, which is also the lowest one. The journey spans all ponds in the cascade.

To test the cascade, each pond has to be completely filled with water. Each pond is attached to a pipe with a valve which, when opened, pours water into the pond. The sizes and capacities of different ponds are different. The pipes and the valves are standardized, so the rate at which water is poured through a valve into a pond is the same for all ponds.

When a pond is filled, water overflows and continues into the next pond. If that pond is also filled, water continues to the next pond after it, and so on, until it either reaches a pond which is not completely filled yet, or it overflows the lowest pond and sinks in the drain at the bottom of the cascade. The time in which the overflowing water reaches the next pond is considered to be zero. The test starts at time 0 with all ponds empty, and all valves are opened simultaneously. The test stops and the valves are closed when all ponds are filled with water.

The pond capacities and the valve flow rate are known. Determine the moment when the lowest pond starts to overflow and the first moment when all ponds are filled.

Input

The input consists of several test cases and continues until the end of the file. Each test case consists of two lines.

The first line contains two integers NN and FF separated by a space (1N1051 \le N \le 10^5, 1F1091 \le F \le 10^9). NN is the number of ponds and FF is the rate of water flow through each valve, expressed in litres per second.

The second line contains NN integers CiC_i separated by spaces (1Ci1091 \le C_i \le 10^9), the pond capacities expressed in litres. The sequence reflects the order of ponds from the topmost one to the lowest one.

Output

For each test case, print a single line with two values separated by a space. The first value is the time at which the lowest pond in the cascade starts to overflow. The second value is the duration of the test, that is, the first moment when all ponds are filled.

Both times are in seconds and are printed as a reduced fraction p/q rather than as a decimal, where pp and qq are positive integers with gcd(p,q)=1\gcd(p, q) = 1. Print the denominator even when the value is an integer. For example, a time of exactly 4 seconds is printed as 4/1.