The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sounds a lot more reasonable if there are some numbers involved, so they have decided to actually calculate some value which would represent how high the temperatures are.

Mathematicians of Berland State University came up with a special heat intensity value. This value is calculated as follows:

Suppose we want to analyze the segment of $n$ consecutive days. We have measured the temperatures during these $n$ days; the temperature during $i$-th day equals $a_i$.

We denote the average temperature of a segment of some consecutive days as the arithmetic mean of the temperature measures during this segment of days. So, if we want to analyze the average temperature from day $x$ to day $y$, we calculate it as $\frac{\sum \limits_{i = x}^{y} a_i}{y - x + 1}$ (note that division is performed without any rounding). The heat intensity value is the maximum of average temperatures over all segments of not less than $k$ consecutive days. For example, if analyzing the measures $[3, 4, 1, 2]$ and $k = 3$, we are interested in segments $[3, 4, 1]$, $[4, 1, 2]$ and $[3, 4, 1, 2]$ (we want to find the maximum value of average temperature over these segments).

You have been hired by Berland State University to write a program that would compute the heat intensity value of a given period of days. Are you up to this task?


-----Input-----

The first line contains two integers $n$ and $k$ ($1 \le k \le n \le 5000$) — the number of days in the given period, and the minimum number of days in a segment we consider when calculating heat intensity value, respectively.

The second line contains $n$ integers $a_1$, $a_2$, ..., $a_n$ ($1 \le a_i \le 5000$) — the temperature measures during given $n$ days.


-----Output-----

Print one real number — the heat intensity value, i. e., the maximum of average temperatures over all segments of not less than $k$ consecutive days.

Your answer will be considered correct if the following condition holds: $|res - res_0| < 10^{-6}$, where $res$ is your answer, and $res_0$ is the answer given by the jury's solution.


-----Example-----
Input
4 3
3 4 1 2

Output
2.666666666666667

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation

Complete search


Solutions:
import math
import collections
import bisect

def arrPrint(a):
	return ' '.join([str(i) for i in a])

def gridPrint(a):
	return '\n'.join([' '.join([str(j) for j in a[i]]) for i in range(len(a))])

def isPalindrome(s):
	for i in range(len(s) // 2):
		if not s[i] == s[-i - 1]:
			return False
	return True

def primeCheck(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def solve(n, k, a):
	ans = 0
	for i in range(k, n + 1):
		sm = sum(a[0:i])
		ans = max(ans, sm / i)
		for j in range(i, n):
			sm -= a[j - i]
			sm += a[j]
			ans = max(ans, sm / i)
	return round(ans, 7)
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
print(solve(n, k, a))


def main():
	(tmpn, tmpk) = input().split(' ')
	(n, k) = (int(tmpn), int(tmpk))
	tmpa = input().split(' ')
	a = [int(i) for i in tmpa]
	p = [0]
	for (i, num) in enumerate(a):
		p.append(p[i] + a[i])
	maximum = 0
	for i in range(k, n):
		for j in range(n - i + 1):
			maximum = max((p[i + j] - p[j]) / i, maximum)
	maximum = max(sum(a) / n, maximum)
	print(maximum)
main()


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
b = [None] * (n + 1)
b[0] = 0
i = 0
while i < n:
	b[i + 1] = b[i] + l[i]
	i += 1
i = 0
while i < n:
	j = i + k
	while j <= n:
		temp = (b[j] - b[i]) / (j - i)
		ans = max(temp, ans)
		j += 1
	i += 1
print(ans)


read = lambda : list(map(int, input().split()))
(n, k) = read()
a = list(read())
s = [0] * (n + 1)
for i in range(1, n + 1):
	s[i] = s[i - 1] + a[i - 1]
ans = 0
for i in range(1, n + 1):
	for j in range(i + k - 1, n + 1):
		t = (s[j] - s[i - 1]) / (j - i + 1)
		ans = max(ans, t)
print(ans)


arr = list(map(int, input().split()))
n = arr[0]
k = arr[1]
arr = list(map(int, input().split()))
arr2 = []
for i in range(k, n + 1):
	temp = sum(arr[0:i])
	temp3 = temp
	for j in range(i, n):
		temp2 = temp3 + arr[j] - arr[j - i]
		temp3 = temp2
		if temp2 > temp:
			temp = temp2
	arr2.append(temp / i)
print(max(arr2))


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(n, k) = f()
l = il()
mx = 0
for i in range(n):
	sm = 0
	for j in range(i, n):
		sm += l[j]
		if j - i + 1 >= k:
			mx = max(mx, sm / (j - i + 1))
print(mx)


(n, k) = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
i = 0
count = k
sum = 0
max = 0
while i < n:
	if i + count - 1 >= n:
		break
	for j in range(i, i + count):
		sum += a[j]
	sred = sum / count
	if sred > max:
		max = sred
	count += 1
	while i + count - 1 < n:
		sum += a[i + count - 1]
		sred = sum / count
		if sred > max:
			max = sred
		count += 1
	count = k
	i += 1
	sum = 0
print(max)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
avg = 0
for i in range(n - k + 1):
	s = sum(arr[i:i + k - 1])
	for j in range(k, n - i + 1):
		s += arr[i + j - 1]
		if s / j > avg:
			avg = s / j
print(avg)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
maxi = float('-inf')
for i in range(n - k + 1):
	s = sum(a[i:i + k])
	c = 0
	cur_maxi = s / k
	for j in range(i + k, n):
		s += a[j]
		c += 1
		cur_maxi = max(cur_maxi, s / (k + c))
	maxi = max(maxi, cur_maxi)
print(maxi)


import math
INT_MAX = 10 ** 18 + 7
MOD = 10 ** 9 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
(n, k) = INPUT()
A = INPUT()
prefixsum = [0 for i in range(n + 1)]
for i in range(1, n + 1):
	prefixsum[i] = A[i - 1] + prefixsum[i - 1]
ans = 0
for len in range(k, n + 1):
	start = 0
	end = len + start - 1
	while end != n:
		ans = max(ans, (prefixsum[end + 1] - prefixsum[start]) / len)
		start += 1
		end += 1
print(ans)


(n, k) = map(int, input().split())
r = list(map(int, input().split()))
a = [0] + r
for i in range(n):
	a[i + 1] += a[i]
s = 0
for i in range(k, n + 1):
	for j in range(i, n + 1):
		s = max(s, (a[j] - a[j - i]) / i)
print(s)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
sums = [0 for i in range(n)]
for (j, item) in enumerate(a):
	if j == 0:
		sums[j] = item
	else:
		sums[j] = item + sums[j - 1]
val = k
max_val = 0
while val <= n:
	for i in range(0, n - val + 1):
		d = sums[i + val - 1]
		if i == 0:
			max_val = max(max_val, d / val)
		else:
			max_val = max(max_val, (d - sums[i - 1]) / val)
	val = val + 1
print(max_val)


(n, k) = list(map(int, input().split()))
temps = [int(i) for i in input().split()]
predpr = [0]
for i in range(n):
	predpr.append(predpr[i] + temps[i])
ma = 0
for i in range(1, n - k + 2):
	for j in range(i + k - 1, n + 1):
		cur = (predpr[j] - predpr[i - 1]) / (j - i + 1)
		if cur > ma:
			ma = cur
print(ma)


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
testcases = 1
for _ in range(testcases):
	(n, k) = vary(2)
	num = array_int()
	maxi = 0.0
	for i in range(n):
		count = 1
		sumt = num[i]
		for j in range(i + 1, n):
			sumt += num[j]
			count += 1
			if count >= k:
				maxi = max(maxi, sumt / count)
	if k == 1:
		print(max(maxi, max(num)))
	else:
		print(maxi)


(n, k) = list(map(int, input().split(' ')))
a = input().split(' ')
for i in range(n):
	a[i] = int(a[i])
s = 0.0
for i in range(n - k + 1):
	prom = sum(a[i:i + k])
	num = k
	if prom / num > s:
		s = prom / num
	for j in range(i + k, min(n, i + 2 * k)):
		prom += a[j]
		num += 1
		if prom / num > s:
			s = prom / num
print(s)


(n, m) = map(int, input().split())
num = [0]
for i in map(int, input().split()):
	num.append(num[-1] + i)
maxn = 0
for i in range(n - m + 1):
	for j in range(i + m, n + 1):
		maxn = max(maxn, (num[j] - num[i]) / (j - i))
print(maxn)


def main():
	(n, k) = list(map(int, input().split()))
	a = [0] + list(map(int, input().split()))
	if k == 1:
		print(max(a))
		return 0
	for i in range(n):
		a[i + 1] += a[i]
	maks = [0] * (n - k + 1)
	for j in range(n - k + 1):
		for i in range(n - j - k + 1):
			maks[j] = max(maks[j], a[i + j + k] - a[i])
	mask = 0
	for i in range(n - k + 1):
		mask = max(mask, maks[i] / (k + i))
	print(mask)
	return 0
main()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = 0
mk = [[0] * n for _ in range(2)]
for k1 in range(k, n + 1):
	i = k1 - k
	if k1 == k:
		c = 0
		s0 = sum(a[:k1])
		mk[0][k - 1] = s0
		for k2 in range(k1, n):
			s0 = s0 - a[k2 - k1] + a[k2]
			mk[0][k2] = s0
	else:
		c = i % 2
		p = 1 - c
		for k2 in range(k1 - 1, n):
			mk[c][k2] = mk[p][k2 - 1] + a[k2]
	m = max(m, max(mk[c]) / k1)
print(m)


for _ in range(1):
	(n, k) = map(int, input().split())
	li = [0] + list(map(int, input().split()))
	if k == 1:
		print(max(li))
		continue
	dic = [0]
	s = 0
	for i in range(1, n + 1):
		s += li[i]
		if i >= k:
			dic.append(s)
			s -= li[i - k + 1]
	ans = 0
	for i in range(1, len(dic)):
		s = dic[i]
		avg = dic[i] / k
		c = 0
		for j in range(i + k, min(n + 1, i + 2 + 2 * k)):
			c += 1
			s += li[j]
			avg = max(avg, s / (k + c))
		ans = max(ans, avg)
	print(ans)


def helper(n, k, l):
	res = 0
	for i in range(n - k + 1):
		base_seg = l[i:i + k]
		sm_bseg = sum(base_seg)
		ln_bseg = len(base_seg)
		ans = sm_bseg / ln_bseg
		for j in range(i + k, n):
			sm_bseg += l[j]
			ln_bseg += 1
			ans = max(ans, sm_bseg / ln_bseg)
		res = max(res, ans)
	return res
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
print(helper(n, k, l))


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
from itertools import accumulate
C = [0] + A
C = list(accumulate(C))
ans = -1
for i in range(n + 1):
	if i + k > n:
		break
	for j in range(i + k, n + 1):
		temp = (C[j] - C[i]) / (j - i)
		ans = max(ans, temp)
print(ans)


import sys
(n, k) = map(int, sys.stdin.readline().split())
liste = list(map(int, sys.stdin.readline().split()))
maxi = 0
for loop in range(n - k + 1):
	used = 0
	s = 0
	for i in range(loop, n, 1):
		s += liste[i]
		used += 1
		if used >= k:
			maxi = max(s / used, maxi)
print(maxi)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
m = 0
for i in range(n):
	s = 0
	for j in range(i, n):
		s += l[j]
		if j - i + 1 >= k:
			m = max(m, s / (j - i + 1))
print(m)


from sys import stdin, stdout
from collections import defaultdict, Counter, deque
for _ in range(1):
	(n, k) = map(int, stdin.readline().split())
	l = list(map(int, stdin.readline().split()))
	s = 0
	l = [0] + l
	for i in range(n + 1):
		s += l[i]
		l[i] = s
	i = 0
	m = 0
	while i < n - k + 1:
		j = i + k
		while j <= min(n, i + 1 + 2 * k):
			t = l[j] - l[i]
			m = max(m, t / (j - i))
			j += 1
		i += 1
	stdout.write(str(m))


import sys
input = sys.stdin.buffer.readline
import os
from math import *
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
ans = 0
for i in range(n - k + 1):
	var = sum(arr[i:i + k]) - arr[i + k - 1]
	for j in range(i + k - 1, n):
		var += arr[j]
		var1 = var / (j - i + 1)
		if ans < var1:
			ans = var1
print(ans)


import heapq
(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
averages = []
heapq.heapify(averages)
for i in range(0, n):
	sum = 0
	for j in range(i, n):
		size = j - i + 1
		sum += a[j]
		if size >= k:
			avg = sum / size
			heapq.heappush(averages, -avg)
print(-1 * averages[0])


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
p = 0
d = 0
c = 0
for i in range(0, n):
	p = sum(a[i:i + k])
	d = k
	c = max(c, p / d)
	for j in range(i + k, min(n, i + 2 * k)):
		p += a[j]
		d += 1
		c = max(c, p / d)
print(c)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = []
for j in range(k, n + 1):
	cur = 0
	for i in range(j):
		cur += a[i]
	ans.append(cur / j)
	for i in range(j, n):
		cur -= a[i - j]
		cur += a[i]
		ans.append(cur / j)
aa = max(ans)
print('%.15f' % aa)


import math
for _ in range(1):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = 0
	for i in range(n):
		c = 0
		sum1 = 0
		for j in range(i, n):
			sum1 += l[j]
			c += 1
			if c >= k:
				ans = max(ans, sum1 / c)
print(ans)


def main():
	(n, k) = map(int, input().split())
	tt = [*map(float, input().split()), 0.0]
	base = sum(tt[:k])
	(lo, hi) = (base / k, max(tt))
	while lo + 5e-07 < hi:
		mid = (lo + hi) * 0.5
		mn = left = 0.0
		right = base - mid * k
		for i in range(k, n + 1):
			if mn > left:
				mn = left
			if mn < right:
				lo = mid
				break
			left += tt[i - k] - mid
			right += tt[i] - mid
		else:
			hi = mid
	print(lo)
main()


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
p = [0] * (n + 1)
for i in range(n):
	p[i + 1] = p[i] + a[i]
ans = 0
for i in range(k - 1, n):
	for j in range(n - k + 1):
		if i - j + 1 >= k:
			ans = max(ans, (p[i + 1] - p[j]) / (i - j + 1))
print(ans)


import collections
from statistics import mean
max = 0
s = input().split()
(n, k) = (int(s[0]), int(s[1]))
a = input().split()
a = [int(i) for i in a]
for i in range(0, n - k + 1):
	s = sum(a[i:i + k])
	m = s / k
	if m > max:
		max = m
	num = k
	for j in range(i + k, n):
		s += a[j]
		num += 1
		m = s / num
		if m > max:
			max = m
print(max)


(n, k) = map(int, input().split(' '))
li = list(map(int, input().split(' ')))
prefixsum = [0]
summ = 0
for i in li:
	summ += i
	prefixsum.append(summ)
maxi = 0
for i in range(k, n + 1):
	for j in range(0, n - i + 1):
		maxi = max(maxi, (prefixsum[i + j] - prefixsum[j]) / i)
print(maxi)


def solve(m):
	dp = [0]
	for e in [val - m for val in a]:
		dp.append(dp[-1] + e)
	rec = 0
	res = dp[k]
	for i in range(k, len(dp)):
		res = max(res, dp[i] - rec)
		rec = min(rec, dp[i - k + 1])
	return res
while True:
	try:
		(n, k) = map(int, input().split())
		a = list(map(int, input().split()))
		(l, r) = (0, 10 ** 9)
		while abs(l - r) > 10 ** (-6):
			m = (l + r) / 2
			if solve(m) >= 0:
				l = m
			else:
				r = m
		print(l)
	except:
		break


(n, k) = input().split()
n = int(n)
k = int(k)
alist = list(map(int, input().split()))
maxi = 0
for i in range(0, n):
	sumi = 0
	for j in range(i, n):
		sumi += alist[j]
		ll = j - i + 1
		if ll >= k:
			if sumi / ll > maxi:
				maxi = sumi / ll
print(maxi)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
(lo, hi) = (0, max(a))
while lo + 1e-10 < hi:
	mid = (lo + hi) / 2
	mn = 0
	s2 = 0
	s = 0
	for i in range(n):
		if i >= k:
			s2 += a[i - k] - mid
			mn = min(mn, s2)
		s += a[i] - mid
		if i + 1 >= k and s >= mn:
			lo = mid
			break
	else:
		hi = mid
print('%.10f' % lo)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0.0
for i in range(n):
	s = 0
	for j in range(i, n):
		s += a[j]
		if j - i + 1 >= k:
			ans = max(ans, s / (j - i + 1))
print('%.20f' % ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = [0]
for i in range(0, n):
	b.append(b[i] + a[i])
answer = 0
for i in range(0, n - k + 1):
	for j in range(i + k, min(n + 1, i + 2 * k)):
		answer = max(answer, (b[j] - b[i]) / (j - i))
print(answer)


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
fenv = [0 for i in range(n)]

def get_pref(i):
	res = 0
	while i >= 0:
		res += fenv[i]
		i = (i & i + 1) - 1
	return res

def update(i, val):
	while i < n:
		fenv[i] += val
		i = i | i + 1

def get_sum(l, r):
	return get_pref(r) - get_pref(l - 1)

def build():
	for i in range(n):
		update(i, a[i])
build()
otv = 0
for i in range(n):
	for j in range(i, n):
		if j - i + 1 >= k:
			otv = max(otv, get_sum(i, j) / (j - i + 1))
print(otv)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
av = [0]
for i in range(0, n):
	av.append(av[i] + s[i])
answer = 0
for i in range(0, n - k + 1):
	for j in range(i + k, min(n + 1, i + 2 * k)):
		answer = max(answer, (av[j] - av[i]) / (j - i))
print('%.15f' % answer)


from collections import defaultdict

def read_int():
	return list(map(int, input().split()))
(n, k) = read_int()
arr = read_int()
sumv = defaultdict(int)
for i in range(n):
	sumv[i] = sumv[i - 1] + arr[i]
ans = []
for i in range(0, n - k + 1):
	for j in range(i + k - 1, n):
		ans.append((sumv[j] - sumv[i - 1]) / (j - i + 1))
print(max(ans))


def solve(n, k, l):
	dp = [[0] * n for _ in range(n + 1)]
	m = 0
	for i in range(1, n + 1):
		for j in range(n):
			if i + j - 1 >= len(l):
				continue
			dp[i][j] = dp[i - 1][j] + l[i + j - 1]
			if i >= k:
				m = max(m, dp[i][j] / i)
	return m
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
print(solve(n, k, l))


def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = -1 * 10 ** 9 + 7
	for i in range(n):
		s = 0
		for j in range(i, n):
			s += a[j]
			if j - i + 1 >= k:
				ans = max(ans, s / (j - i + 1))
	print(ans)
main()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
avg = 0
for i in range(n - k + 1):
	su = sum(a[i:i + k])
	m = k
	avg = max(avg, su / m)
	for j in range(i + k, n):
		su += a[j]
		m += 1
		avg = max(avg, su / m)
print(avg)


def max_average(nums, k):

	def get_delta(avg, nums, k):
		n = len(nums)
		accu = [0.0] * (n + 1)
		minval_pos = None
		delta = 0.0
		for i in range(n):
			accu[i + 1] = nums[i] + accu[i] - avg
			if i >= k - 1:
				if minval_pos == None or accu[i - k + 1] < accu[minval_pos]:
					minval_pos = i - k + 1
				if accu[i + 1] - accu[minval_pos] >= 0:
					delta = max(delta, (accu[i + 1] - accu[minval_pos]) / (i + 1 - minval_pos))
		return delta
	(left, delta) = (min(nums), float('inf'))
	while delta > 1e-06:
		delta = get_delta(left, nums, k)
		left += delta
	return left

def f(arr, k):
	return max_average(arr, k)
(n, k) = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
print(f(arr, k))


(n, k) = list(map(int, input().split()))
s = list(map(int, input().split()))
x = sum(s[0:k])
ans = -1000000000000000
for i in range(n - k + 1):
	av = sum(s[i:k + i]) / k
	if av > ans:
		ans = av
	for j in range(n - k - i):
		av = (av * (k + j) + s[k + i + j]) / (k + j + 1)
		if av > ans:
			ans = av
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
arr = []
arr.append(0)
for i in range(len(a)):
	arr.append(a[i] + arr[-1])
m = 0
for i in range(k, n + 1):
	for j in range(i, n + 1):
		s = (arr[j] - arr[j - i]) / i
		m = max(m, s)
print(str.format('{0:.15f}', m))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = 0
for i in range(0, n - k + 1):
	x = sum(a[i:k + i - 1])
	y = k - 1
	for j in range(k + i, n + 1):
		x += a[j - 1]
		y += 1
		if x / y > m:
			m = x / y
print(m)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
sum = 0
ans = -10 ** 11
for i in range(n):
	sum = 0
	for j in range(i, n):
		sum += a[j]
		if j - i >= k - 1:
			ans = max(ans, sum / (j - i + 1))
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
ps = [0]
for i in a:
	ps.append(ps[-1] + i)
for j in range(k, n + 1):
	for i in range(n):
		if n < i + j:
			break
		s = max(s, (ps[i + j] - ps[i]) / j)
print(s)


import sys
(total, days) = map(int, sys.stdin.readline().rstrip().split(' '))
temp = list(map(int, sys.stdin.readline().rstrip().split(' ')))
temp_sum = []
result = 0
temp_sum.append(result)
for i in temp:
	result += i
	temp_sum.append(result)
maximum = 0
for d in range(days, total + 1, 1):
	l = [temp_sum[i + d] - temp_sum[i] for i in range(0, total - d + 1, 1)]
	average = max(l) / d
	if average > maximum:
		maximum = average
print(maximum)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
p = [0]
for i in range(0, n):
	p.append(p[i] + l[i])
ans = 0
for i in range(n - k + 1):
	for j in range(i + k, min(n + 1, i + 2 * k)):
		ans = max(ans, (p[j] - p[i]) / (j - i))
print(ans)


def read():
	return [int(i) for i in input().split()]
(n, k) = read()
ls = [0] + read()
for i in range(1, n + 1):
	ls[i] += ls[i - 1]
ans = 0
for i in range(1, n + 2 - k):
	for j in range(i + k - 1, n + 1):
		ans = max(ans, (ls[j] - ls[i - 1]) / (j - i + 1))
print('%.9f' % ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = 0
if n == k:
	print(sum(a) / n)
	quit()
b = [sum(a[:k])]
m = max(b[0] / k, m)
for i in range(n - k):
	b += [b[i] - a[i] + a[k + i]]
	m = max(b[i + 1] / k, m)
for j in range(n - k):
	b.pop(-1)
	for i in range(n - k - j):
		b[i] = b[i] + a[k + j + i]
		m = max(b[i] / (k + 1 + j), m)
print(m)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
rsum = [0]
maxx = 0.0
for i in range(n):
	rsum.append(rsum[-1] + arr[i])
for ki in range(k, n + 1):
	for i in range(n - ki + 1):
		tot = 0
		avg = (rsum[i + ki] - rsum[i]) / ki
		maxx = max(maxx, avg)
print(maxx)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
find = [0] * n
for i in range(n):
	find[i] = [0] * n
presum = [0] * n
presum[0] = arr[0]
for i in range(1, n):
	presum[i] = presum[i - 1] + arr[i]
for i in range(n - k + 1):
	for j in range(i + k - 1, n):
		if i == 0:
			find[i][j] = presum[j] / (j + 1)
		else:
			find[i][j] = (presum[j] - presum[i - 1]) / (j - i + 1)
maxi = 0
for i in range(n):
	for j in range(n):
		if find[i][j] > maxi:
			maxi = find[i][j]
print(maxi)


(n, k) = map(int, input().split())
ar = list(map(int, input().split()))
average = M = 0
for i in range(n):
	s = 0
	for j in range(i, n):
		s += ar[j]
		if j - i + 1 >= k:
			average = s / (j - i + 1)
			M = max(M, average)
print(M)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
S = [0 for l in range(n)]
S[0] = A[0]
for l in range(1, n):
	S[l] = S[l - 1] + A[l]
S = [0] + S
ans = 0
for s in range(n - k + 1):
	for t in range(s + 1):
		ans = max((S[t + (n - s)] - S[t]) / (n - s), ans)
print(ans)


(n, x) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for k in range(x, n + 1):
	s = sum(a[:k])
	ans = max(ans, s / k)
	for i in range(k, n):
		s -= a[i - k]
		s += a[i]
		ans = max(ans, s / k)
print(ans)


(n, k) = map(int, input().split())
temps = list(map(int, input().split()))
hiv = 0
for l in range(k, n + 1):
	total = sum(temps[:l])
	hiv = max(hiv, total / l)
	for e in range(l, n):
		total -= temps[e - l]
		total += temps[e]
		hiv = max(hiv, total / l)
print(hiv)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
if k == 1:
	print(max(arr))
else:
	pref = [0] * n
	pref[0] = arr[0]
	for i in range(1, n):
		pref[i] = pref[i - 1] + arr[i]
	ans = 0
	for i in range(k, n + 1):
		for j in range(i - 1, n):
			summ = pref[j]
			if j >= i:
				summ -= pref[j - i]
			ans = max(ans, summ / i)
	print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))

def max_sum(m):
	pref = [0]
	for i in (x - m for x in a):
		pref += [pref[-1] + i]
	ans = pref[k]
	min_p = 0
	for i in range(k, len(pref)):
		ans = max(ans, pref[i] - min_p)
		min_p = min(min_p, pref[i - k + 1])
	return ans
l = 0
r = 5000.0
while abs(r - l) > 1e-06:
	m = (r + l) / 2
	if max_sum(m) >= 0:
		l = m
	else:
		r = m
print(r)


(days, k) = list(map(int, input().split()))
numbers = list(map(int, input().split()))
cum_sum = [0] * (len(numbers) + 1)
cum_sum[0] = 0
for i in range(0, len(numbers)):
	cum_sum[i + 1] = cum_sum[i] + numbers[i]
best_mean = 0
size = len(numbers)
if k == 1:
	print(max(numbers))
else:
	for i in range(k, size + 1):
		for j in range(0, size):
			if size - j < i:
				break
			seq_mean = (cum_sum[i + j] - cum_sum[j]) / i
			if seq_mean > best_mean:
				best_mean = seq_mean
	print(best_mean)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
i = 0
m = -10000
while i < len(l):
	j = i
	x = 1
	som = 0
	while j < len(l):
		if x < k:
			som += l[j]
			x = x + 1
			j = j + 1
			continue
		else:
			som += l[j]
			av = som / (j - i + 1)
			if av > m:
				m = av
			j = j + 1
	i += 1
print(m)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
prefix = [a[0]]
for i in range(1, n):
	prefix.append(prefix[-1] + a[i])
ans = []
for i in range(n):
	for j in range(i + k - 1, n):
		if i == 0:
			ans.append(prefix[j] / (j - i + 1))
		else:
			ans.append((prefix[j] - prefix[i - 1]) / (j - i + 1))
print(max(ans))


(n, k) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
a = [0] * n
a[0] = l[0]
for i in range(1, n):
	a[i] = a[i - 1] + l[i]
a = [0] + a
m = -1
for i in range(n - k + 1):
	s = a[i + k] - a[i]
	for j in range(i + k, n):
		if s / (j - i) > m:
			m = s / (j - i)
		s += l[j]
	if s / (n - i) > m:
		m = s / (n - i)
print(m)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
sum = 0
ma = 0.0
for i in range(k, n + 1):
	start = 0
	last = i
	sum = 0
	for i in range(0, last):
		sum = sum + a[i]
	ma = max(sum / (i + 1), ma)
	while last < n:
		last = last + 1
		sum = sum - a[start] + a[last - 1]
		start = start + 1
		ma = max(sum / (i + 1), ma)
print(ma)


def check(x, A):
	sum = 0
	for i in range(x):
		sum += A[i]
	ans = sum / x
	for i in range(x, n):
		sum -= A[i - x]
		sum += A[i]
		a = sum / x
		if a > ans:
			ans = a
	return ans
(n, k) = map(int, input().split())
A = list(map(int, input().split()))
f_ans = 0
while k <= n:
	ans = check(k, A)
	if ans > f_ans:
		f_ans = ans
	k += 1
print(f_ans)


import sys
input = sys.stdin.buffer.readline
(n, k) = map(int, input().split())
arr = [int(x) for x in input().split()]
x = 0
dp = []
for i in range(n):
	x = x + arr[i]
	dp.append(x)
ans = 0
for i in range(n):
	for j in range(i + k - 1, n):
		ans = max(ans, (dp[j] - dp[i] + arr[i]) / (j - i + 1))
print(ans)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
dp = [0 for i in range(n + 1)]
for i in range(n):
	dp[i + 1] = dp[i] + l[i]
z = float('-inf')
for i in range(n, k - 1, -1):
	t = t = float('-inf')
	for j in range(n, i - 1, -1):
		r = dp[j] - dp[j - i]
		t = max(t, r)
	z = max(z, t / i)
print(z)


from sys import *
(n, k) = map(int, stdin.readline().split())
arr = list(map(int, stdin.readline().split()))
avg = 0
for i in range(n):
	cnt = 0
	sum = 0
	for j in range(i, n):
		sum += arr[j]
		cnt += 1
		if cnt >= k:
			avg = max(avg, sum / cnt)
print(avg)


from sys import stdin, stdout
import bisect

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	(n, k) = mp()
	l = li()
	if k == 1:
		pr(max(l))
	else:
		mi = -1000
		c = 0
		x = []
		for i in l:
			x.append(c + i)
			c += i
		z = []
		for i in range(n - k + 1):
			for j in range(i + k - 1, n):
				s = x[j]
				if i != 0:
					y = x[i - 1]
				else:
					y = 0
				p = (s - y) / (j - i + 1)
				if p > mi:
					mi = p
		print(mi)
for _ in range(1):
	solve()


rd = lambda : list(map(int, input().split()))
(n, k) = rd()
a = rd()
r = 0
s = [0]
for x in a:
	s.append(s[-1] + x)
for i in range(n - k + 1):
	for j in range(i + k, min(n + 1, i + 2 * k)):
		r = max(r, (s[j] - s[i]) / (j - i))
print(r)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
sum = 0
i = 0
b = [None] * (n + 1)
b[0] = 0
ans = -100.0
while i < n:
	sum = sum + l[i]
	b[i + 1] = sum
	i = i + 1
i = 0
while i < n:
	j = i + k - 1
	while j < n:
		temp = (b[j + 1] - b[i]) / (j - i + 1)
		if temp > ans:
			ans = temp
		j = j + 1
	i = i + 1
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for L in range(n):
	s = sum(a[L:L + k])
	kol = k
	ans = max(ans, s / kol)
	for R in range(L + k, min(n, L + 2 * k)):
		s += a[R]
		kol += 1
		ans = max(ans, s / kol)
print(ans)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
sum = [None for i in range(n)]
for i in range(n):
	sum[i] = sum[i - 1] + a[i] if i > 0 else a[i]
ans = []
m = 0
ans0 = 0
for j in range(k, n + 1):
	ans = []
	for i in range(n - j + 1):
		tmp = sum[i + j - 1] - sum[i - 1] if i > 0 else sum[i + j - 1]
		ans.append(tmp)
	m = max(ans)
	ans0 = max(ans0, m / j)
print(ans0)


def averageTemperature(n, k, measures):
	res = 0
	s = [0]
	for x in measures:
		s.append(s[-1] + x)
	for i in range(n - k + 1):
		for j in range(i + k, min(n + 1, i + 2 * k)):
			res = max(res, (s[j] - s[i]) / (j - i))
	return res
(n, k) = map(int, input().split(' '))
measures = [int(x) for x in input().split(' ')]
print(averageTemperature(n, k, measures))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
avg = 0
for i in range(n):
	cnt = 0
	sum = 0
	for j in range(i, n):
		sum += a[j]
		cnt += 1
		if cnt >= k:
			avg = max(avg, sum / cnt)
print(avg)


(n, k) = map(int, input().split())
inp = []
inp = list(map(int, input().split()))
summ = 0
maxo = 0
while k <= n:
	summ = 0
	for i in range(0, k):
		summ += inp[i]
		avg = summ / k
		if avg > maxo:
			maxo = summ / k
	for i in range(0, n - k):
		summ = summ - inp[i] + inp[i + k]
		avg = summ / k
		if avg > maxo:
			maxo = avg
	k += 1
print(maxo)


(n, k) = map(int, input().split())
a = [0] + list(map(int, input().split()))
for i in range(n):
	a[i + 1] += a[i]
ans = 0
for i in range(n - k + 1):
	for j in range(i + k - 1, n):
		tmp = (a[j + 1] - a[i]) / (j - i + 1)
		if tmp > ans:
			ans = tmp
print(ans)


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
(b, ans) = ([0, a[0]], 0.0)
for i in range(1, len(a)):
	b.append(b[-1] + a[i])
if n == k:
	ans = b[n] / n
for i in range(n - k + 1):
	for j in range(i + k, min(n + 1, i + 2 * k)):
		ans = max((b[j] - b[i]) / (j - i), ans)
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
tec = 0
s = []
for i in a:
	tec += i
	s.append(tec)
mmt = s[k - 1] / k
for x in range(0, n - k + 1):
	for y in range(x + k - 1, n):
		if x == 0:
			summa = s[y]
		else:
			summa = s[y] - s[x - 1]
		mmt = max(mmt, summa / (y - x + 1))
print(mmt)


import math
import itertools
getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int, input().split()))
(n, k) = getInputIntList()
a = getInputIntList()
p = [0, a[0]]
for i in a[1:n]:
	p.append(p[len(p) - 1] + i)
m = 0
while k <= n:
	ans = []
	for i in range(n - k + 1):
		m = max((p[i + k] - p[i]) / k, m)
	k += 1
print(m)


from sys import stdin, stdout
get_string = lambda : stdin.readline().strip('\n')
get_intmap = lambda : map(int, get_string().split(' '))

def ncr_generator(n, r):
	ncrr = 1
	while True:
		yield ncrr
		n += 1
		ncrr = ncrr * n // (n - r)

def testcase():
	(n, k) = get_intmap()
	a = tuple(get_intmap())
	cumsum = [0] * (n + 1)
	for (ind, i) in zip(range(1, n + 1), a):
		cumsum[ind] = cumsum[ind - 1] + i
	ans = 0
	for step in range(k, n + 1):
		tmp = 0
		for end in range(step, n + 1):
			tmp = max(tmp, cumsum[end] - cumsum[end - step])
		ans = max(ans, tmp / step)
	print(ans)
testcase()


import sys, heapq
(n, k) = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
pf = [0] * (n + 1)
pf[0] = arr[0]
for i in range(1, n):
	pf[i] = pf[i - 1] + arr[i]
ans = 0
for i in range(n):
	for j in range(n):
		left = i
		right = j
		if right - left + 1 >= k:
			temp = pf[right] - pf[left - 1]
			ans = max(ans, temp / (right - left + 1))
print(ans)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	ans = 0
	for i in range(k, n + 1):
		temp = 0
		for j in range(i):
			temp += a[j]
		t = i
		ans = max(ans, temp / i)
		while t < n:
			temp = temp - a[t - i] + a[t]
			t += 1
			ans = max(ans, temp / i)
	print('%.10f' % ans)
main()


from sys import stdin, stdout
from math import gcd, ceil, sqrt
from collections import Counter
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(n, k) = iia()
arr = iia()
res = float('-inf')
for i in range(k, n + 1):
	tot = sum(arr[:i])
	res = max(res, tot / i)
	for j in range(i, n):
		tot += arr[j] - arr[j - i]
		res = max(res, tot / i)
	k += 1
print(round(res, 15))


(n, k) = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
maxx = 0
for i in range(n - k + 1):
	j = i
	summ = 0
	while j - i + 1 < k:
		summ += a[j]
		j += 1
	while j < n:
		summ += a[j]
		maxx = max(maxx, summ / (j - i + 1))
		j += 1
print(maxx)


import math
from collections import defaultdict
from sys import stdin, stdout
input = stdin.readline

def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	pref = [0] * n
	for (i, val) in enumerate(a):
		pref[i] = a[i] if i == 0 else a[i] + pref[i - 1]

	def rng(start, end):
		if start == 0:
			return pref[end]
		return pref[end] - pref[start - 1]
	_max = 0
	for i in range(n):
		for j in range(i + k - 1, n):
			_max = max(_max, rng(i, j) / (j - i + 1))
	print(_max)
main()


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
a = [0] + list(map(int, input().split()))
for i in range(1, n + 1):
	a[i] += a[i - 1]
ans = 0
for i in range(k, n + 1):
	for j in range(n - i + 1):
		ans = max(ans, (a[i + j] - a[j]) / i)
print(ans)


import sys, math, bisect
inf = float('inf')
mod = 10 ** 9 + 7

def lcm(a, b):
	return int(a / math.gcd(a, b) * b)

def gcd(a, b):
	return int(math.gcd(a, b))

def tobinary(n):
	return bin(n)[2:]

def binarySearch(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def lowerBound(a, x):
	i = bisect.bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def upperBound(a, x):
	i = bisect.bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def primesInRange(n):
	ans = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			ans.append(p)
	return ans
from collections import deque, defaultdict
for _ in range(1):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	ans = 0
	if k == 1:
		ans = max(arr)
	for i in range(n):
		s = 0
		for j in range(i, n):
			s += arr[j]
			if j - i + 1 < k:
				continue
			ans = max(ans, s / (j - i + 1))
	print(ans)


(n, k) = map(int, input().split())
p = [0]
maxx = 0
s = input().split()
for i in range(n):
	p.append(p[i] + int(s[i]))
for i in range(k, n + 1):
	for j in range(1, n - i + 2):
		if maxx < (p[j + i - 1] - p[j - 1]) / i:
			maxx = (p[j + i - 1] - p[j - 1]) / i
print(maxx)


(n, k) = map(int, input().split())
ai = list(map(int, input().split()))
minm = 0
for i in range(0, len(ai)):
	summ = 0
	for j in range(i, len(ai)):
		summ += ai[j]
		if j - i + 1 >= k:
			res = summ / (j - i + 1)
			minm = max(minm, res)
print(minm)


(n, k) = map(int, input().split())
s = [int(i) for i in input().split()]
p = [0] * (n + 1)
for i in range(1, n + 1):
	p[i] = p[i - 1] + s[i - 1]
ma = -5000
for i in range(k, n + 1):
	for j in range(k, n + 1):
		sred = (p[j] - p[j - i]) / i
		if sred > ma:
			ma = sred
print(ma)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
for i in range(1, n):
	a[i] += a[i - 1]
a = [0] + a[:]
ans = 0
for i in range(k, n + 1):
	m = 0
	for j in range(1, n - i + 2):
		m = max(m, a[j + i - 1] - a[j - 1])
	ans = max(ans, m / i)
print(ans)


[n, k] = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
pre = [0 for i in range(n + 5)]
pre[0] = a[0]
for i in range(1, n):
	pre[i] += pre[i - 1] + a[i]
res = 0
for i in range(n - k + 1):
	for j in range(i + k - 1, min(n, i + 2 * k - 1)):
		y = j - i + 1
		x = pre[j] - (pre[i - 1] if i > 0 else 0)
		res = max(res, x / y)
print(res)


a = input().split(' ')
n = int(a[0])
k = int(a[1])
v = [int(i) for i in input().split(' ')]
ans = 0
for i in range(n):
	ctot = 0
	for j in range(i, n):
		ctot += v[j]
		clen = j - i + 1
		if clen >= k:
			ans = max(ans, ctot / clen)
print(ans)


import sys
import math
import collections

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(1):
	(n, k) = get_ints()
	arr = get_list()
	ans = 0
	for i in range(n):
		val = arr[i]
		c = 1
		sol = 0
		if c >= k:
			sol = max(sol, val / c)
		for j in range(i + 1, n):
			val += arr[j]
			c += 1
			if c >= k:
				sol = max(sol, val / c)
		ans = max(sol, ans)
	print(ans)


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def r():
	return int(input())

def rm():
	return map(int, input().split())

def rl():
	return list(map(int, input().split()))
(n, K) = rm()
a = rl()
maxi = 0
for k in range(K, n + 1):
	indpSum = sum(a[:k])
	maxi = max(indpSum / k, maxi)
	for i in range(k, n):
		indpSum = indpSum + a[i] - a[i - k]
		maxi = max(maxi, indpSum / k)
print(maxi)


def main():
	(n, k) = map(int, input().split())
	tt = list(map(int, input().split()))
	(avr, acc) = (sum(tt) / n, [0.0])
	(x, best, lo) = (0.0, -1000000000.0, 0)
	for t in tt:
		x += t - avr
		acc.append(x)
	for (i, x) in enumerate(acc[k:], k):
		for j in range(lo, i - k + 1):
			e = (x - acc[j]) / (i - j)
			if best < e:
				(best, lo, hi) = (e, j, i)
	print(sum(tt[lo:hi]) / (hi - lo))
main()


from sys import stdin
(a, b) = map(int, stdin.readline().split())
c = list(map(int, stdin.readline().split()))
ans = 0
p = [0]
for i in range(a):
	p += [p[-1] + c[i]]
for i in range(1, a - b + 2):
	for j in range(b + i - 1, a + 1):
		ans = max(ans, (p[j] - p[i - 1]) / (j - i + 1))
print(ans)


(n, k) = [int(x) for x in input().split()]
li = [int(x) for x in input().split()]
ans = 0.0
for i in range(n):
	s = 0
	for ii in range(i, n):
		s += li[ii]
		if ii - i + 1 >= k:
			ans = max(ans, s / (ii - i + 1))
print('{:.20f}'.format(ans))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
b = [0] * (n + 1)
for i in range(1, n + 1):
	s += a[i - 1]
	b[i] = s
opt_sum = 0
opt_num = k
for i in range(k, n + 1):
	for j in range(n - i + 1):
		s = b[j + i] - b[j]
		temp_sum = s * opt_num
		temp_opt_sum = opt_sum * i
		if temp_sum > temp_opt_sum:
			opt_sum = s
			opt_num = i
print(opt_sum / opt_num)


(n, k) = [int(i) for i in input().split()]
a = [float(i) for i in input().split()]
wk1 = [i for i in a]
wk2 = [0] + [i for i in a]
wk1.sort()
wk1.reverse()
for i in range(1, n):
	wk1[i] += wk1[i - 1]
for i in range(1, n):
	a[i] += a[i - 1]
a = [0] + a
max_ans = 0
max_power = k
for i in range(k, n + 1):
	if wk1[i - 1] * max_power < max_ans * i:
		continue
	for j in range(1, n - i + 2):
		if wk2[j - 1] > wk2[j + i - 1]:
			continue
		ans = a[j + i - 1] - a[j - 1]
		if ans * max_power > max_ans * i:
			max_ans = ans
			max_power = i
print(max_ans / max_power)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a = [0] + a
for e in range(n):
	a[e + 1] += a[e]
best = 0
for i in range(k, n + 1):
	for j in range(i, n + 1):
		summ = a[j] - a[j - i]
		best = max(best, summ / i)
print(best)


import atexit, io, sys, collections, math, heapq, fractions, copy, os, functools
import sys
import random
import collections
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
ais = list(map(int, input().split()))
ans = -1

def f(ais, k):
	ans = -1
	q = collections.deque([])
	s = 0
	for i in range(len(ais)):
		q.append(ais[i])
		s += ais[i]
		if len(q) > k:
			s -= q.popleft()
		if len(q) == k:
			ans = max(ans, s)
	return ans / k
print(max([f(ais, j) for j in range(k, len(ais) + 1)]))


def mp():
	return map(int, input().split())

def it():
	return int(input())
(n, k) = mp()
l = list(mp())
ans = 0
for i in range(n):
	(avg, count) = (0, 0)
	for j in range(i, n):
		count += l[j]
		if j - i + 1 >= k:
			avg = count / (j - i + 1)
		ans = max(avg, ans)
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
avg = 0
for i in range(0, n - k + 1):
	s = sum(a[i:i + k - 1])
	p = k - 1
	for j in range(i + k, n + 1):
		s += a[j - 1]
		p += 1
		avg = max(avg, s / p)
print(avg)


from itertools import accumulate
(n, k) = map(int, input().split())
a = map(int, input().split())
sums = [0] + list(accumulate(a))
res = 0
for l in range(k, n + 1):
	for i in range(0, n - l + 1):
		res = max(res, (sums[i + l] - sums[i]) / l)
print(res)


from itertools import accumulate
(n, k) = [int(x) for x in input().split()]
arr = [0] + [int(x) for x in input().split()]
asu = list(accumulate(arr))
maxs = -1000000000.0
for i in range(k, n + 1):
	for j in range(k, n + 1):
		avg = (asu[j] - asu[j - i]) / i
		maxs = max(maxs, avg)
print(maxs)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
rt = -1
ap = [a[0]]
for i in range(1, n):
	ap.append(ap[i - 1] + a[i])
for ki in range(k, n + 1):
	ans = -1
	for i in range(n - ki + 1):
		if i + ki - 1 < n:
			if i > 0:
				ans = max(ans, ap[i + ki - 1] - ap[i - 1])
			else:
				ans = max(ans, ap[i + ki - 1])
	rt = max(rt, ans / ki)
print(rt)


import sys
input = sys.stdin.readline

def I():
	return input().strip()

def II():
	return int(input().strip())

def LI():
	return [*map(int, input().strip().split())]
import copy, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter, OrderedDict
from operator import itemgetter
import itertools
for _ in range(1):
	(n, k) = LI()
	l = LI()
	z = -1
	for i in range(n):
		sum = 0
		for j in range(i, n):
			sum += l[j]
			if j - i + 1 >= k:
				if float(sum) / float(j - i + 1) > z:
					z = float(sum) / float(j - i + 1)
	print(z)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
if k == n:
	print(sum(a) / k)
else:
	q = sum(a) / n
	ans = 0
	for i in range(n):
		s = 0
		for j in range(i, n):
			s += a[j]
			if j - i + 1 >= k:
				ans = max(ans, s / (j - i + 1))
	print(max(q, ans))


from itertools import accumulate
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
acc = [0] + list(accumulate(a))
ans = 0
for i in range(n - k + 1):
	for j in range(i + k, n + 1):
		s = acc[j] - acc[i]
		t = s / (j - i)
		ans = max(t, ans)
print(ans)


(n, k) = tuple(map(int, input().split(' ')))
alist = list(map(int, input().split(' ')))
temp = 0
for i in range(n - k + 1):
	top = sum(alist[i:i + k - 1])
	base = k - 1
	for j in range(i + k, n + 1):
		top += alist[j - 1]
		base += 1
		temp = max(temp, top / base)
print(temp)


import sys
(n, k) = [int(i) for i in sys.stdin.readline().split(' ')]
a = [int(i) for i in sys.stdin.readline().split(' ')]
ans = 0
for i in range(n):
	temp = 0
	for j in range(i, n):
		temp += a[j]
		now = temp / (j - i + 1)
		if j - i + 1 >= k:
			ans = max(ans, now)
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
preSUMM = [0, a[0]]
for i in range(2, n + 1):
	preSUMM.append(preSUMM[i - 1] + a[i - 1])
sp = -1
s = -1
for i in range(n + 1):
	for j in range(n - k + 2):
		if i - j >= k:
			s = (preSUMM[i] - preSUMM[j]) / (i - j)
		if s >= sp:
			sp = s
print(sp)


firstRange = 0
intensitySum = 0
rangeSum = 0
intensity = 0
(n, k) = tuple(map(int, input().split()))
a = tuple(map(int, input().split()))
for i in range(k - 1):
	firstRange += a[i]
for _len in range(k, n + 1):
	firstRange += a[_len - 1]
	rangeSum = firstRange
	intensitySum = firstRange
	for i in range(1, n - _len + 1):
		rangeSum += a[i - 1 + _len] - a[i - 1]
		if intensitySum < rangeSum:
			intensitySum = rangeSum
	if intensitySum / _len > intensity:
		intensity = intensitySum / _len
print('{:0.12f}'.format(intensity))


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
cum = [0] * (n + 1)
cum[0] = 0
for i in range(n):
	cum[i + 1] += cum[i] + arr[i]
res = 0
for i in range(1, n - k + 2):
	t = i + k - 1
	for j in range(t, t + k):
		if j > n:
			break
		y = j - i + 1
		x = cum[j] - cum[i - 1]
		res = max(res, x / y)
print(res)


(n, k) = [int(i) for i in input().split()]
list1 = [int(i) for i in input().split()]
maxi = 0.0
count = k - 1
for i in range(n - k + 1):
	s = sum(list1[i:i + k])
	maxi = max(maxi, s / k)
	num = k
	for j in range(i + k, min(2 * k + i, n)):
		s += list1[j]
		num += 1
		maxi = max(maxi, s / num)
print(maxi)


(n, k) = map(int, input().split())
a = list(map(int, input().split())) + [0]
q = [0] * (n + 1)
for i in range(1, n + 1):
	q[i] = q[i - 1] + a[i - 1]
s = 0
for i in range(n):
	j = 0
	while i + k + j <= n:
		rec = (q[i + k + j] - q[i]) / (k + j)
		s = max(s, rec)
		j += 1
print(s)


def solve(l):
	maxi = 0
	for i in range(n):
		for j in range(i, n):
			if j - i + 1 >= k:
				z1 = i + 1
				z2 = j + 1
				sum = pref[z2] - pref[z1 - 1]
				maxi = max(sum / (j - i + 1), maxi)
	return maxi
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
pref = [0]
for i in l:
	pref.append(pref[-1] + i)
print(solve(l))


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
pre = [0]
for c in arr:
	pre.append(pre[-1] + c)
ans = 0
for i in range(k, n + 1):
	for j in range(i - k, max(-1, i - 2 * k - 1), -1):
		ans = max(ans, (pre[i] - pre[j]) / (i - j))
print(ans)


(n, k) = map(int, input().split())
li = [int(num) for num in input().split(' ', n - 1)]
ans = []
for i in range(0, n):
	su = 0
	for j in range(i, n):
		su += li[j]
		if j - i + 1 >= k:
			ans.append(su / (j - i + 1))
print(max(ans))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
ruiseki = [0 for i in range(n)]
for i in range(n):
	if i == 0:
		ruiseki[i] = a[i]
	else:
		ruiseki[i] = a[i] + ruiseki[i - 1]
for i in range(n - k + 1):
	total = ruiseki[i + k - 1]
	if i > 0:
		total -= ruiseki[i - 1]
	ans = max(ans, total / k)
	j = 1
	while i + k - 1 + j < n:
		total += a[i + k - 1 + j]
		ans = max(ans, total / (k + j))
		j += 1
print(ans)


import sys
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
(N, K) = MAP()
A = LIST()
ans = 0
for l in range(N - K + 1):
	sm = 0
	for r in range(l, N):
		sm += A[r]
		cnt = r - l + 1
		if cnt >= K:
			ans = max(ans, sm / cnt)
print(ans)


def go():
	(n, k) = [int(i) for i in input().split(' ')]
	a = [int(i) for i in input().split(' ')]
	maxx = float('-inf')
	for i in range(n - k + 1):
		s = sum(a[i:i + k - 1])
		for j in range(i + k - 1, n):
			s += a[j]
			so_far = s / (j - i + 1)
			if so_far > maxx:
				maxx = so_far
	return maxx
print(go())


(n, k) = input().split()
n = int(n)
k = int(k)
p = []
a = [float(x) for x in input().split()]
p.append(int(0))
for i in range(1, len(a) + 1):
	p.append(p[i - 1] + a[i - 1])
mx = float(0)
for i in range(k, n + 1):
	for j in range(0, n - i + 1):
		cur = float((p[j + i] - p[j]) / float(i))
		mx = max(cur, mx)
print(mx)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	(n, k) = li()
	a = li()
	s = 0
	m = 0
	p = 1
	for i in range(k, n + 1):
		s = sum(a[:i])
		m = max(s / i, m)
		for j in range(i, n):
			s -= a[j - i]
			s += a[j]
			m = max(s / i, m)
	print(m)
for _ in range(1):
	case()


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
diff = 0
ma = 0
for i in range(k, n + 1):
	f = sum(a[:i])
	for j in range(n - i + 1):
		if j != 0:
			f -= a[j - 1]
			f += a[j + i - 1]
		f1 = f / i
		ma = max(ma, f1)
print(ma)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
mx = 0
for i in range(n - k + 1):
	sm = sum(arr[i:i + k])
	mx = max(mx, sm / k)
	for j in range(i + k, n):
		sm += arr[j]
		mx = max(mx, sm / (j - i + 1))
print(mx)