#include<iostream>#include<cstring>#include<algorithm>usingnamespace std;constint N =1e5+10;int n, F;double a[N], s[N];boolcheck(double avg){//预处理前缀和for(int i =1; i <= n; i ++) s[i]= s[i -1]+ a[i]- avg;double mins =0;//维护全局最小值for(int k = F; k <= n; k ++){
mins =min(mins, s[k - F]);if(s[k]>= mins)returntrue;}returnfalse;}intmain(){
cin >> n >> F;double l =0, r =0;for(int i =1; i <= n; i ++){scanf("%lf",&a[i]);
r =max(r, a[i]);}//while(r - l >1e-5){double mid =(l + r)/2;if(check(mid)) l = mid;else r = mid;}printf("%d\n",(int)(r *1000));//只能输出r,因为乘完1000要下取整。return0;}