#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
long long a[100005];
bool moze(long long x) {
  long long st[100005];
  long long curr = 0;
  for (long long i = 0; i < n; i++) {
    long long t = x - a[i];
    if (t < 0) t = 0;
    if (i >= k) curr -= st[i - k];
    st[i] = t - curr;
    if (st[i] < 0) st[i] = 0;
    curr += st[i];
  }
  long long res = 0;
  for (long long i = 0; i < n; i++) res += st[i];
  return res <= m;
}
void solve() {
  long long l = 1;
  long long r = 1000100000;
  long long x;
  while (l <= r) {
    long long m = (l + r) / 2;
    if (moze(m)) {
      l = m + 1;
      x = m;
    } else
      r = m - 1;
  }
  printf("%lld", x);
}
int main() {
  scanf("%lld%lld%lld", &n, &m, &k);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  solve();
  return 0;
}
