extern crate core;

use std::fmt;
use std::cmp::{Ordering, min, max};
use std::f32::MAX;
use std::ops::{Add, Sub, Mul, Div, Neg, Index, IndexMut, SubAssign, Range};
use std::collections::{BTreeMap, VecDeque, BinaryHeap, BTreeSet, HashMap};
use std::fmt::{Display, Formatter, Error};
use std::hash::{Hash, Hasher};

fn show<T: Display>(vec: &Vec<T>) {
    if vec.is_empty() {
        println!("[]");
    }else {
        print!("[{}", vec[0]);
        for i in 1 .. vec.len() {
            print!(", {}", vec[i]);
        }
        println!("]");
    }
}
fn show2<T: Display>(vec: &Vec<Vec<T>>) {
    if vec.is_empty() {
        println!("[]");
    }else {
        for l in vec {
            show(l);
        }
    }
}
macro_rules! read_line{
    () => {{
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).ok();
        line
    }};
    (delimiter: ' ') => {
        read_line!().split_whitespace().map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (delimiter: $p:expr) => {
        read_line!().split($p).map(|x|x.to_string()).collect::<Vec<_>>()
    };
    (' ') => {
        read_line!(delimiter: ' ')
    };
    ($delimiter:expr) => {
        read_line!(delimiter: $delimiter)
    };
    (' '; $ty:ty) => {
        read_line!().split_whitespace().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
    ($delimiter:expr; $ty:ty) => {
        read_line!($delimiter).into_iter().map(|x|x.parse::<$ty>().ok().unwrap()).collect::<Vec<$ty>>()
    };
}
macro_rules! read_value{
    () => {
        read_line!().trim().parse().ok().unwrap()
    }
}
macro_rules! let_all {
    ($($n:ident:$t:ty),*) => {
        let line = read_line!(delimiter: ' ');
        let mut iter = line.iter();
        $(let $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
    };
}
macro_rules! let_mut_all {
    ($($n:ident:$t:ty),*) => {
        let line = read_line!(delimiter: ' ');
        let mut iter = line.iter();
        $(let mut $n:$t = iter.next().unwrap().parse().ok().unwrap();)*
    };
}

struct MaxSegmentTree<T> {
    vec: Vec<Vec<T>>
}
impl <T: Ord + Copy + Clone> MaxSegmentTree<T> {
    fn from_vec(initial: &Vec<T>) -> MaxSegmentTree<T> {
        let mut result = vec![initial.clone()];
        let mut len = initial.len();
        while len != 1 {
            len /= 2;
            let mut v = Vec::with_capacity(len);
            for i in 0 .. len {
                v.push(max(result[result.len() - 1][i * 2], result[result.len() - 1][i * 2 + 1]));
            }
            result.push(v);
        }
        MaxSegmentTree{vec: result}
    }
    fn max_of(&self, from: usize, until: usize) -> T {
        let mut max_depth = 0;
        let mut max_position = from;
        let mut left = from;
        let mut right = until - 1;
        for i in 0 .. self.vec.len() {
            let v = &self.vec[i];
            if left % 2 == 1 && self.vec[max_depth][max_position] < v[left] {
                max_depth = i;
                max_position = left;
            }
            if right % 2 == 0 && self.vec[max_depth][max_position] < v[right] {
                max_depth = i;
                max_position = right;
            }
            if left == right {
                break
            }else {
                left = (left + 1) / 2;
                right = (right - 1) / 2;
                if left > right {
                    break
                }
            }
        }
        self.vec[max_depth][max_position]
    }
    fn renew(&mut self, mut position: usize, value: &T) {
        self.vec[0][position] = *value;
        for i in 1 .. self.vec.len() {
            position /= 2;
            if position < self.vec[i].len() {
                let max_value = max(self.vec[i - 1][position * 2], self.vec[i - 1][position * 2 + 1]);
                if self.vec[i][position] == max_value {
                    break
                }else {
                    self.vec[i][position] = max_value;
                }
            }else {
                break
            }
        }
    }
}
fn can_make(n: usize, for_right: &MaxSegmentTree<i64>, for_left: &MaxSegmentTree<i64>, r: i32, m: i64, c: i64) -> bool {
    let mut current = 0_i64;
    for i in 0 .. n {
        let right = for_right.max_of(i, min((i as i32 + r + 1) as usize, n)) + (i as i64) * c;
        let left = if i as i32 != max(0, (i as i32 - r)) {for_left.max_of(max(0, (i as i32 - r)) as usize, i) + (n - 1 - i) as i64 * c} else {0};
        current += max(right, left);
        if current >= m {
            return true
        }
    }
    false
}
fn main() {
    let_all!(n: usize, m: i64, c: i64);
    let smell: Vec<i64> = read_line!(' '; i64);
    let mut for_right = smell.clone();
    let mut for_left = smell.clone();
    for i in 0 .. n {
        for_right[i] -= c * i as i64;
        for_left[n - i - 1] -= c * i as i64;
    }
    let for_right = MaxSegmentTree::from_vec(&for_right);
    let for_left = MaxSegmentTree::from_vec(&for_left);
    let mut min_r = 0;
    let mut max_r = n as i32;
    while min_r < max_r {
        let mid_r = (min_r + max_r) / 2;
        if can_make(n, &for_right, &for_left, mid_r, m, c) {
            max_r = mid_r;
        }else {
            min_r = mid_r + 1;
        }
    }
    if can_make(n, &for_right, &for_left, max_r, m, c) {
        println!("{}", max_r);
    }else {
        println!("-1");
    }
}


Measured memory_bytes: 11164