#include #define rep(i,a,b) for(int i=a;i=b;i--) #define fore(i,a) for(auto &i:a) #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- template vector slideMinimum(const vector &a, int k) { deque deq;vector res; rep(i,0,a.size()){while(deq.size()&&a[deq.back()]>=a[i])deq.pop_back();deq.push_back(i); if (i-k+1>=0){res.push_back(deq.front());if(deq.front()==i-k+1)deq.pop_front();}}return res;} /*---------------------------------------------------------------------------------------------------             ∧_∧       ∧_∧  (´<_` )  Welcome to My Coding Space!      ( ´_ゝ`) /  ⌒i     /   \    | |     /   / ̄ ̄ ̄ ̄/  |   __(__ニつ/  _/ .| .|____      \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ #define EPS 1e-10 int N, K; string A; //--------------------------------------------------------------------------------------------------- double B[1010101], C[1010101]; int check(double p) { rep(i, 0, N * 2) B[i] = (double)(A[i] - '0') - p; C[0] = B[0]; rep(i, 1, N * 2) C[i] = C[i - 1] + B[i]; rep(i, 0, N * 2) C[i] *= -1; auto D = slideMinimum(vector(C, C + N * 2), N - K + 1); rep(i, 0, N * 2) C[i] *= -1; rep(i, 0, N) if (C[i] <= C[D[i + K]] + EPS) return 1; return 0; } //--------------------------------------------------------------------------------------------------- void _main() { cin >> N >> K >> A; A += A; double ok = 0, ng = 1.1; rep(i, 0, 30) { double x = (ok + ng) / 2; if (check(x)) ok = x; else ng = x; } printf("%.10f\n", ok); }