#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
double a[100005], b[100005], sum[100005];
int main()
{
int N, L;
scanf("%d%d",&N,&L);
memset(sum,0,sizeof(sum));
for(int i = 1; i <= N; i++){
scanf("%lf",&a[i]);
}
double eps = 1e-5, l = -1e6, r = 1e6;
while(r - l > eps){
double mid = (l + r) / 2;
for(int i = 1; i <= N; i++){
b[i] = a[i] - mid;
}
for(int i = 1; i <= N; i++){
sum[i] = sum[i-1] + b[i];
}
double min_val = 1e6, ans = -1e6;
for(int i = L; i <= N; i++){
min_val = min(min_val,sum[i-L]);
ans = max(ans,sum[i]-min_val);
}
if(ans >= 0){
l = mid;
}
else r = mid;
}
printf("%d\n",int(r*1000));
return 0;
}