#include using namespace std; typedef long long int64; std::vector< int > slideMinimum(const std::vector< double > &a, int k) { int n = a.size(); std::deque< int > deq; std::vector< int > res; for(int i = 0; i < n; i++) { 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; } int main() { int64 N, K; string A; cin >> N >> K; cin >> A; auto check = [&](double k) { int sum = 0; queue< double > lazy; lazy.emplace(0.0); vector< double > all(N + N + N, 1e9); int last = 11451419; for(int i = 0; i < N + N; i++) { if(K <= i + 1) { all[i + N - 1] = lazy.front(); last = min(last, i); lazy.pop(); } sum += A[i % N] - '0'; lazy.emplace(sum - (i + 1) * k); } auto p = slideMinimum(all, N); sum = 0; for(int i = 0; i < N + N; i++) { sum += A[i % N] - '0'; if(last <= i) { if(all[p[i]] <= sum - (i + 1) * k) return (true); } } return (false); }; double low = 0.0, high = 1.0; for(int i = 0; i < 23; i++) { double mid = (low + high) * 0.5; if(check(mid)) low = mid; else high = mid; } cout << fixed << setprecision(10) << low << endl; }