#include <bits/stdc++.h>
using namespace std;
long long int n, m, k, p, a[100005], dp[100005];
bool t(long long int x) {
  long long int cnt = 0, ans = 0;
  for (int i = 1; i <= n; i++) dp[i] = 0;
  for (int i = 1; i <= n; i++) {
    if (i > k) cnt -= dp[i - k];
    p = a[i] + cnt;
    if (x > p) {
      dp[i] = x - p;
      cnt += x - p;
      ans += x - p;
    }
  }
  if (ans <= m)
    return true;
  else
    return false;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long int l = 1, r = 2e9, mid = 0;
  while (l < r) {
    mid = (l + r) / 2 + 1;
    if (t(mid))
      l = mid;
    else
      r = mid - 1;
  }
  cout << l;
}
