#include <bits/stdc++.h>
using namespace std;
long long int n, m, w;
long long int a[100005];
long long int b[100005];
bool can(long long int d) {
  long long int sum = 0;
  long long int day = 0;
  for (int i = 1; i <= n; i++) {
    if (i > w) sum -= b[i - w];
    if (a[i] + sum < d) {
      long long int need = d - (a[i] + sum);
      day += need;
      b[i] = need;
      sum += need;
    } else
      b[i] = 0;
  }
  return day <= m;
}
int main() {
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long int i = 0, j = 1e9 + 1e5 + 5;
  long long int d, best = -1;
  while (i <= j) {
    d = (i + j) / 2;
    if (can(d)) {
      i = d + 1;
      best = max(best, d);
    } else
      j = d - 1;
  }
  cout << best;
  return 0;
}
