#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

int main()
{
	int N, K;
	cin >> N >> K;
	vector<double> P(N);
	rep(i, N) {
		cin >> P[i];
		P[i] = (P[i] + 1) / 2.0;
	}
	vector<double> Sm(N, 0);

	for (int i = 0; i < K; ++i) {
		Sm[0] += P[i];
	}
	double max_sum = Sm[0];
	int idx = 0;

	for (int i = 1; i <= (N - K); ++i) {
		Sm[i] = Sm[i - 1] - P[i - 1] + P[i + K - 1];
		if (Sm[i] > max_sum) {
			idx = i;
			max_sum = Sm[i];
		}
	}
	cout << fixed << setprecision(10) << max_sum << endl;
	return 0;
} 
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

template<class T> inline bool chmin(T& a, T b){
    if(a > b){
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

int main(){

    int n;
    ll T;
    cin >> n >> T;
    ll ans = 0;
    vector<ll> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    for(int i = 1; i < n; i++){
        ans += min(T, v[i] - v[i-1]);
    }
    ans += T;
    cout << ans << endl;

    return 0;
}
