#include using namespace std; int n,k;string s; bool check(double mid){ vectorpre(2*n+1,0.0); for(int j=0;j<2*n;j++){ int val=(s[j]=='1')?1:0; pre[j+1]=pre[j]+(val-mid); }dequeq; for(int j=0;j<2*n;j++){ int now=j+1,ima=now-k; if(ima>=0){ while(!q.empty()&&pre[q.back()]>=pre[ima])q.pop_back(); q.push_back(ima); }int imi=now-n; if(imi<0)imi=0; while(!q.empty()&&q.front()=k){ if(!q.empty()){ if(pre[now]-pre[q.front()]>=-1e-9)return 1; } } } return 0; } int main(){ ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); cin>>n>>k>>s;s=s+s; double low=0.0,high=1.0; for (int i=0;i<100;i++){ double mid=(low+high)/2; if(check(mid))low = mid; else high=mid; } printf("%.15lf",high); return 0; }