#include <bits/stdc++.h>
using namespace std;
long long n, m, w, h[100010], t[100010];
inline bool ok(long long x) {
  long long s = 0, sum = 0;
  for (int i = 1; i <= n; i++) {
    if (i > w) sum -= t[i - w];
    if (sum + h[i] >= x) {
      t[i] = 0;
      continue;
    }
    t[i] = x - (h[i] + sum);
    sum += t[i];
    s += t[i];
  }
  return s <= m;
}
int main() {
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) cin >> h[i];
  long long low = 0, high = 1e10;
  while (low < high) {
    long long mid = (low + high) >> 1;
    if (ok(mid))
      low = mid + 1;
    else
      high = mid;
  }
  cout << low - 1;
  return 0;
}
