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