#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000009;
long long a[100005], t[100005], n, w, m;
bool check(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 + a[i] >= x) {
      t[i] = 0;
      continue;
    }
    t[i] = x - (a[i] + sum);
    sum += t[i];
    s += t[i];
  }
  return s <= m;
}
int main() {
  long long i, j, mn = INF;
  cin >> n >> m >> w;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    mn = min(mn, a[i]);
  }
  long long l = mn, r = mn + m + 10, mid;
  while (l < r) {
    mid = (l + r) / 2;
    if (check(mid))
      l = mid + 1;
    else
      r = mid;
  }
  cout << l - 1;
  return 0;
}
