#include using namespace std; #define endl '\n' typedef double f64; const int N = 1e6 + 10; const f64 eps = 1e-7; int n, k; string s; f64 a[N], sum[N]; inline bool check(f64 x) { for (int i = 1; i <= n; i++) a[i] = a[i + n] = (s[i] - '0' - x); for (int i = 1; i <= 2 * n; i++) sum[i] = sum[i - 1] + a[i]; deque q; q.push_back(0); for (int i = k; i <= 2 * n; i++) { while (!q.empty() && i - q.front() > n) q.pop_front(); int j = q.front(); if (sum[i] - sum[j] > eps) return 1; while (!q.empty() && sum[q.back()] - sum[i - k + 1] > eps) q.pop_back(); q.push_back(i - k + 1); } return 0; } int main(int argc, char const *argv[]) { ios::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); cin >> n >> k >> s; s = ' ' + s; f64 l = 0, r = 1, ans = l; while (r - l > eps) { f64 mid = (l + r) / 2; if (check(mid)) ans = mid, l = mid; else r = mid; } cout << fixed << setprecision(15) << ans << endl; return 0; }