#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,n) for(int i=0; i=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector VI; typedef vector VL; typedef vector VVL; typedef vector VVI; typedef pair P; typedef pair PL; vector slide_min(vector &a, int k){ vector ret; deque dq; REP(i,a.size()){ while (!dq.empty() && a[dq.back()] >= a[i]) dq.pop_back(); dq.push_back(i); if (i - k + 1 >= 0){ ret.push_back(a[dq.front()]); if (dq.front() == i - k + 1) dq.pop_front(); } } return ret; } bool check(vector &a, int k){ int n = a.size() / 2; vector b(2*n+1); REP(i,2*n) b[i+1] += b[i] + a[i]; vector mi = slide_min(b, n - k + 1); REP(i,n) if (mi[i] <= b[n+1+i]) return true; return false; } int main() { int n, k; string s; cin >> n >> k; cin >> s; // cout << 0 << endl; // return 0; vector a(n); REP(i,n) a[i] = s[i] - '0'; REP(i,n) a.push_back(a[i]); double ok = 0.0, ng = 1.0; REP(_,100){ vector b(a); double mi = (ok + ng) / 2.0; REP(i,2*n) b[i] -= mi; if (check(b, k)) ok = mi; else ng = mi; } printf("%.10f\n", ok); return 0; }