#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef vector vi; typedef vector vvi; #define rep(i,n) for(ll i=0;i<(n);i++) #define tii tuple #define tiii tuple #define mt make_tuple #define pb push_back #define ALL(a) (a).begin(),(a).end() #define FST first #define SEC second const int INF = (INT_MAX/2); const ll LLINF = (LLONG_MAX/2); const double eps = 1e-5; const double PI = M_PI; #define DEB cerr<<"!"<0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;} class segtree{ public: int Node; vector table; segtree(int); int ope(const int,const int); void update(int index,const int value){ // index is 0-indexed. index += Node; // query function table[index] = value; while(index > 0){ index /= 2; table[index] = ope(table[2*index],table[2*index+1]); } } int find(int l, int r); }; int segtree::find(int l,int r){ // l,r is 0-indexed. if(l == r) return table[r+Node]; l += Node; r += Node; int ans = 0; for(; l <= r;l >>=1, r >>=1){ if(r == l){ans=ope(ans,table[l]); return ans;} if(r%2 == 0) ans=ope(ans,table[r]),--r; if(l%2) ans=ope(ans,table[l]),++l; } return ans; } segtree::segtree(int Max_Node){ // initialize Node = 2; while(Node < Max_Node) Node *= 2; table.resize(2*Node); for(int i = Node;i < Node*2; i++) table[i] = 0; // initialize for(int i= Node-1; i > 0; i--) table[i] = ope(table[i*2],table[i*2+1]); } int segtree::ope(const int a,const int b){ return a+b; } int main(){ int n,k; cin >> n >> k; segtree st(1000000); string s; cin >> s; s = s + s; rep(i,s.size()) if(s[i] == '1') st.update(i,1); vi table1; vi table2; rep(i,s.size()){ if(s[i] == '1'){ table1.pb(i); while(s[i] == '1')i++; } } for(int i = s.size()-1; i >= 0; i--){ if(s[i] == '1'){ table2.pb(i); while(s[i] == '1')i--; } } vi tt(table2.size()); rep(i,table2.size()){tt[i] = table2[table2.size()-1-i];} table2 = tt; double ans = 0; rep(i,table1.size()) rep(j,table2.size()){ int l = table1[i]; int r = table2[j]; if(l+k-1 < (int)s.size())ans = max(ans,double(st.find(l,l+k-1))/double(k)); if(r - l + 1 < k) continue; if(r - l + 1 > n) break; ans = max(ans,double(st.find(l,r))/double(r-l+1)); } cout << fixed << setprecision(10) << ans << endl; }