Hongjun and the Fence

Time limit1sMemory limit256 MB

Problem

Hongjun has to paint an old fence. The fence consists of N planks, each 1 cm wide, with possibly different heights. To paint faster, he bought a roller called Super Paint Roller Deluxe whose width is X cm.

While painting, every part of the roller must stay on the planks. Otherwise paint may drip and stain the surroundings. The roller must also remain parallel to the ground. Therefore, one safe roller stroke chooses X consecutive planks and paints them from the ground up to the full height of the shortest plank among those X planks. Hongjun may repeat this operation with any other group of X consecutive planks.

Some parts of the planks may remain unpainted by the roller, and Hongjun must paint those parts with a toothbrush. Since that is tedious, help him paint as much area as possible with the roller. If there are several ways to achieve the maximum roller-painted area, Hongjun wants to use the minimum possible number of roller strokes.

Write a program that computes the minimum area that must be painted with the toothbrush and, among all ways that achieve that area, the minimum number of roller strokes.

Input

The first line contains the number of planks N (1 <= N <= 1,000,000) and the roller width X (1 <= X <= 100,000, X <= N).

The second line contains N positive integers, each at most 1,000,000, representing the heights of the planks.

Output

Print the minimum area of the planks that Hongjun must paint with the toothbrush on the first line.

Print the minimum number of roller strokes needed to achieve that area on the second line.