import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayDeque; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) throws FileNotFoundException { long t = System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis() - t); } boolean check(double m, int n, int k, int[] a) { double[] sum = new double[2 * n]; for (int i = 0; i < 2 * n; ++i) { if (a[i % n] == 1) sum[i] += 1 - m; else sum[i] -= m; sum[i] += i > 0 ? sum[i - 1] : 0; } if (sum[k - 1] >= 0) return true; MonotonePriorityQueue que = new MonotonePriorityQueue(); for (int i = 0; i < k; ++i) { que.add(sum[i]); } for (int i = k; i + k < 2 * n; ++i) { que.add(sum[i]); if (que.sz > n - k + 1) que.poll(); if (sum[i + k] - que.min() >= 0) return true; } return false; } void run() { Scanner sc = new Scanner(); int n = sc.nextInt(); int k = sc.nextInt(); int[] a = new int[n]; String str = sc.next(); for (int i = 0; i < n; ++i) a[i] = str.charAt(i) - '0'; double ng = 1; double ok = 0; for (int t = 0; t < 25; ++t) { double middle = (ok + ng) / 2; if (check(middle, n, k, a)) { ok = middle; } else { ng = middle; } } System.out.println(ok); } class MonotonePriorityQueue { int sz; ArrayDeque que = new ArrayDeque<>(); void poll() { if (sz == 0) throw new AssertionError(); --sz; --que.getFirst().sz; if (que.getFirst().sz == 0) que.pollFirst(); } double min() { return que.getFirst().val; } void add(double v) { ++sz; int cnt = 1; while (!que.isEmpty() && que.peekLast().val >= v) { cnt += que.peekLast().sz; que.pollLast(); } que.addLast(new Val(v, cnt)); } private class Val { double val; int sz; public Val(double val_, int sz_) { val = val_; sz = sz_; } } } class Scanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } private void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } public boolean hasNext() { skipUnprintable(); return hasNextByte(); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { return (int) nextLong(); } } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }