#966
Gold II
OGRADA
스페셜 저지채점 준비중
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Matija needs to paint his old fence. The fence is made from N planks, each 1 cm in width and varying in height. To do this easy and fast, he bought himself a Super Paint Roller Deluxe. The paint roller is X cm wide. The Super Paint Roller Deluxe model comes with a catch, however. Matija must at all times touch the planks with full width of the roller, otherwise paint drops all around and stains everything. Also, the roller must always be parallel to the ground to prevent leakage. This means that in order for Matija to use the roller safely, he needs to select X planks, and paint them from bottom to the top of the lowest plank in one swoop. Then he selects some other X planks, paints them and so on. This leaves parts of some planks unpainted. Matija will have to paint such parts with a toothbrush. This is obviously quite tedious so he asked you to help him paint as much as possible using the Super Paint Roller Deluxe. Since there is more than one way to do this he is also interested in the painting that requires the minimal number of swoops.

입력

The first line of input contains two integers N (1 ≤N ≤1 000 000), number of planks, and X (1 ≤X ≤100 000), width of the Super Paint Roller. Width of the Super Paint Roller will not exceed the width of the fence. The second line of input contains N positive integers, smaller than 1 000 000, heights of planks in the fence.

출력

The first line of output should contain the smallest possible area Matija will have to paint manually. The second line of output should contain the smallest number of swoops needed.

예제 입력 1

5 3
5 3 4 4 5

예제 출력 1

3
2

예제 입력 2

10 3
3 3 3 3 3 3 3 3 3 3

예제 출력 2

0
4

예제 입력 3

7 4
1 2 3 4 3 2 1

예제 출력 3

4
4
코드 제출

이 문제는 현재 제출할 수 없습니다.

이 현상이 잘못되었다고 생각될 경우 관리자한테 문의주세요.

내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Gold II1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.