
import Data.Function (on)

sn::Int->Double
sn n = div' (n + 1) 2

div' = (/) `on` fromIntegral

solve::Int->[Double]->Double
solve k snn | k == 1 = maxExpectedValue 0
            | k == length snn = maxExpectedValue 1
            | otherwise = maxExpectedValue k
          where 
            maxExpectedValue p = maximum $ zipWith subtract snn (drop p snn)

main = do
  [n, k] <- map read . words <$> getLine::IO[Int]
  pn <- map read . words <$> getLine
  let snn = scanl1 (+) $ map sn pn
  print $ solve k snn