High School Programming League 2008/2009

Building with Blocks

Problem code: HS09BWB

Little John enjoys playing with blocks. He builds constructions along an imaginary straight line in such a way that we can describe his work by means of an integer N, the length of the line, and a list of N non-negative integers, the height of the building at each horizontal position.

Today he would like to build a skyscraper. But, before that, he needs to make sure there are K consecutive positions of the same height, in order to use that section as a base for the skyscraper.

You are to write a program that finds a section such that the number of block addition/removal operations needed to achieve such a flat base is minimized.

You may assume Little John has an infinite number of blocks at his disposal.

Input

Input starts with two space separated integers: the length of the line (1<=N<=1000000) and the length of the required base (1<=K<=N). N space-separated non-negative integers follow, representing the height of the current building at each horizontal position (0<=Hi<=1000000).

Output

Output two space-separated integers O and P on a single line. The first one must correspond to the number of operations needed to make the base in the section starting at position P (the leftmost position is 0 and the rightmost is N-1). P must be as small as possible.

Example

Input:
6 4
0 4 2 4 5 8

Output:
3 1

Added by:Yandry Perez
Date:2010-03-05
Time limit:5s-18s
Source limit:50000B
Languages:SED C99 strict C++ 4.0.0-8 C++ 4.3.2 TCL SCALA NICE NEM BASH PHP SCM guile LISP sbcl LISP clisp ERL TECS TEXT DOC PDF PS PERL 6 JS
Resource:High School Programming League 2009/10
SPOJ System © 2010 Sphere Research Labs. All Rights Reserved.