#include <bits/stdc++.h>
int a[100000] = {0};
int start_in[100000] = {0};
int main(int argc, const char *argv[]) {
  int i, n, m, w, ans;
  int min = 1;
  int max = 1000100001;
  long long d, k;
  scanf("%d %d %d", &n, &m, &w);
  for (i = 0; i < n; i++) scanf("%d", a + i);
  for (;;) {
    k = 0;
    d = 0;
    ans = (min + max) / 2;
    for (i = 0; i < n; i++) {
      start_in[i] = ans - a[i] - k;
      if (start_in[i] < 0) start_in[i] = 0;
      d += start_in[i];
      k += start_in[i] - ((i < w - 1) ? 0 : start_in[i - w + 1]);
    }
    if (d == m || min == ans)
      break;
    else if (d > m)
      max = ans;
    else
      min = ans;
  }
  printf("%d\n", ans);
  return 0;
}
