#include <bits/stdc++.h>
using namespace std;
using ll = long double;

int main() {
    double n, k;
    cin >> n >> k;

    vector<ll> arr(n);
    for (int i = 0; i < n; i++) {
        ll x; cin >> x;
        arr[i] = (x + 1.0) / 2.0;
    }

    ll ans = 0;
    for (int i = 0; i < k; i++) ans += arr[i];
    ll temp = ans;

    for (int i = k; i < n; i++) {
        temp = temp + arr[i] - arr[i-k];
        ans = max(ans, temp);
    }

    printf("%0.7Lf\n", ans);
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;

int n, k, ans = 0, prt[N];
vector<int> g[N];

int dfs(int u, int fa) {
  int res = 0;
  for (auto v : g[u]) {
    res = max(res, dfs(v, u));
  }
  if (res == k - 1 && fa != 1) {
    res = -1;
    ans++;
  }
  return res + 1;
}

int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &prt[i]);
    if (i > 1) {
      g[prt[i]].push_back(i);
    }
  }
  if (prt[1] != 1) {
    ans ++;
    prt[1] = 1;
  }
  dfs(1, 1);
  printf("%d\n", ans);
  return 0;
}