import sys from collections import deque def main(): N, K = map(int, sys.stdin.readline().split()) a = list(map(int, sys.stdin.readline().strip())) doubled = a + a prefix = [0] * (2 * N + 1) for i in range(2 * N): prefix[i + 1] = prefix[i] + doubled[i] low = 0.0 high = 1.0 for _ in range(100): mid = (low + high) / 2 if check(mid, N, K, prefix): low = mid else: high = mid print("{0:.15f}".format(low)) def check(r, N, K, prefix): q = deque() for i in range(2 * N + 1): # Remove elements from the front that are out of the window's start (i - N) while q and q[0] < (i - N): q.popleft() # Add j = i - K if applicable if i >= K: j = i - K if j >= 0: val_j = prefix[j] - r * j # Maintain deque in increasing order of val_j while q and (prefix[q[-1]] - r * q[-1]) >= val_j: q.pop() q.append(j) # Check current value against the minimum in the deque current_val = prefix[i] - r * i if q: min_val = prefix[q[0]] - r * q[0] if current_val >= min_val: return True return False if __name__ == '__main__': main()