#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <iomanip>
using ll=long long;
using namespace std;

int main(){
    int N,K;
    cin>>N>>K;
    vector<int> P(N+2);
    for(int i=0;i<N;i++){
        cin>>P[i];
    }

    int tmp=0;
    for(int i=0;i<K;i++){
        tmp+=P[i];
    }
    int maxnum=tmp;
    for(int i=0;i+K<N;i++){
        tmp-=P[i];
        tmp+=P[i+K];
        if(tmp>maxnum){
            maxnum=tmp;
        }
    }
    double ans=(maxnum+K)/(double)2;
    cout<<fixed<<setprecision(7)<<ans<<endl;

    return 0;
}
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll N,M,i,a,c = 0;scanf("%lld%lld",&N,&M);
  map<ll,ll> mp;
  mp[0] = 1;
  for(i=0;i<N;i++){
    scanf("%lld",&a);
    c = (c+a) % M;
    if(mp.find(c) != mp.end()) mp[c]++;
    else mp[c] = 1;
  }
  ll ans = 0;
  for(auto itr = mp.begin();itr != mp.end();itr++) ans += itr->second*(itr->second-1)/2;
  printf("%lld\n",ans);
}
