#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
long long a[maxn];
int cnt[maxn];
int n, m, w;
bool check(long long x) {
  memset(cnt, 0, sizeof(cnt));
  long long ans = 0;
  long long last = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i] + last <= x) {
      ans += x - a[i] - last;
      cnt[i] = x - a[i] - last;
      last += cnt[i];
      if (ans > m) return 0;
    }
    if (i >= w) last -= cnt[i - w + 1];
  }
  return ans <= m;
}
int main() {
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long l = 0, r = 1LL << 40;
  while (r > l) {
    long long mid = (r + l) >> 1;
    if (check(mid))
      l = mid + 1;
    else
      r = mid;
  }
  cout << l - 1 << endl;
  return 0;
}
