#include <bits/stdc++.h>
using namespace std;
int arr[100000];
struct Node {
  int min, pos;
  int add;
  int l, r;
  Node *lNode, *rNode;
};
void newNode(Node*& node, int l, int r) {
  node = new Node();
  node->l = l;
  node->r = r;
  node->add = 0;
  if (l == r) {
    node->min = arr[l];
    node->pos = l;
    node->lNode = NULL;
    node->rNode = NULL;
    return;
  }
  int mid = (l + r) / 2;
  newNode(node->lNode, l, mid);
  newNode(node->rNode, mid + 1, r);
  if (node->lNode->min <= node->rNode->min) {
    node->min = node->lNode->min;
    node->pos = node->lNode->pos;
  } else {
    node->min = node->rNode->min;
    node->pos = node->rNode->pos;
  }
}
void update(Node*& node, int l, int r, int add) {
  node->add += add;
  if (node->r < l || node->l > r) return;
  if (node->l >= l && node->r <= r) {
    node->add += 1;
    return;
  }
  update(node->lNode, l, r, node->add);
  update(node->rNode, l, r, node->add);
  node->add = 0;
  if (node->lNode->min + node->lNode->add <=
      node->rNode->min + node->rNode->add) {
    node->min = node->lNode->min + node->lNode->add;
    node->pos = node->lNode->pos;
  } else {
    node->min = node->rNode->min + node->rNode->add;
    node->pos = node->rNode->pos;
  }
}
int main() {
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 0; i < n; i++) cin >> arr[i];
  Node* root;
  newNode(root, 0, n - 1);
  int minleft = n - w;
  for (int i = 0; i < m; i++) {
    int left = root->pos;
    if (left > minleft) left = minleft;
    update(root, left, left + w - 1, 0);
  }
  cout << root->min + root->add;
}
