#include <bits/stdc++.h>
using namespace std;
const long long OO = (long long)1e18 + 7;
const int mod = (int)1e9 + 9;
const int NMAX = (int)1e5 + 5;
const int MAX = (int)1e9 + 1e6;
int n, m, w, x[NMAX];
bool pred(int tg) {
  priority_queue<pair<int, int>, vector<pair<int, int>>,
                 greater<pair<int, int>>>
      pq;
  int tot = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    while (!pq.empty() && pq.top().first < i) {
      tot -= pq.top().second;
      pq.pop();
    }
    if (x[i] + tot < tg) {
      int rq = tg - (x[i] + tot);
      tot += rq;
      cnt += rq;
      if (cnt > m) return false;
      pq.push(make_pair(i + w - 1, rq));
    }
  }
  return true;
}
int binSearch(int lo, int hi) {
  while (lo < hi) {
    int mid = lo + (hi - lo + 1) / 2;
    if (pred(mid))
      lo = mid;
    else
      hi = mid - 1;
  }
  return lo;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  while (cin >> n >> m >> w) {
    for (int i = 0; i < n; i++) cin >> x[i];
    cout << binSearch(1, MAX) << "\n";
  }
  return 0;
}
