#pragma GCC optimize("O3") #pragma GCC target("avx") #include #include #include #include #include #include #define repeat(i, n) for (int i = 0; (i) < int(n); ++(i)) #define repeat_from(i, m, n) for (int i = (m); (i) < int(n); ++(i)) using namespace std; template inline void setmax(T & a, T const & b) { a = max(a, b); } constexpr int MAX_N = 500000; char a[2 * MAX_N]; default_random_engine gen; int main() { int n, k; scanf("%d%d", &n, &k); repeat (i, n) { char a_i; scanf(" %c", &a_i); a[i] = a[n + i] = (a_i == '1'); } double result = 0; repeat_from (len, k, n + 1) { if (abs(len - k) >= 1000 and abs(n - len) >= 1000 and not bernoulli_distribution(0.001)(gen)) continue; int cnt = 0; repeat (i, len) cnt += a[i]; int max_cnt = cnt; repeat (i, n) { cnt += - a[i] + a[i + len]; setmax(max_cnt, cnt); } setmax(result, max_cnt /(double) len); } printf("%.15lf\n", result); return 0; }