#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
double all[N] , sum[N];
int n , k;
bool check(double mid)
{
for(int i = 1 ; i <= n ; i ++) sum[i] = all[i] - mid;
for(int i = 1 ;i <=n ; i ++) sum[i] += sum[i - 1];
double an = -1e9 , b= 1e9 ;
//找最小值
for(int i = k ; i <= n ; i ++)
{
b = min(b ,sum[i - k ]);
an = max(an, sum[i] - b );
}
if(an >= 0 ) return true;
return false;
}
int main()
{
cin>>n>>k;
for(int i = 1 ; i <= n ;i ++) cin>>all[i];
double l = 0 , r = 2000;
while(r - l >1e-9)
{
double mid = (l + r) / 2 ;
if(check(mid))
{
l = mid;
}
else r = mid;
}
int res = r * 1000;
cout<<res;
return 0;
}