Problem:
Score : 900 points

Problem Statement

Alice lives on a line. Today, she will travel to some place in a mysterious vehicle.
Initially, the distance between Alice and her destination is D. When she input a number x to the vehicle, it will travel in the direction of the destination by a distance of x if this move would shorten the distance between the vehicle and the destination, and it will stay at its position otherwise. Note that the vehicle may go past the destination when the distance between the vehicle and the destination is less than x.

Alice made a list of N numbers. The i-th number in this list is d_i. She will insert these numbers to the vehicle one by one.

However, a mischievous witch appeared. She is thinking of rewriting one number in the list so that Alice will not reach the destination after N moves.

She has Q plans to do this, as follows:

Rewrite only the q_i-th number in the list with some integer so that Alice will not reach the destination.

Write a program to determine whether each plan is feasible.

Constraints

1≤ N ≤ 5*10^5

1≤ Q ≤ 5*10^5

1≤ D ≤ 10^9

1≤ d_i ≤ 10^9(1≤i≤N)

1≤ q_i ≤ N(1≤i≤Q)

D and each d_i are integers.

Input

Input is given from Standard Input in the following format:

N D
d_1 d_2 ... d_N
Q
q_1 q_2 ... q_Q

Output

Print Q lines. The i-th line should contain YES if the i-th plan is feasible, and NO otherwise.

Sample Input 1

4 10
3 4 3 3
2
4 3

Sample Output 1

NO
YES

For the first plan, Alice will already arrive at the destination by the first three moves, and therefore the answer is NO.
For the second plan, rewriting the third number in the list with 5 will prevent Alice from reaching the destination as shown in the following figure, and thus the answer is YES.

Sample Input 2

5 9
4 4 2 3 2
5
1 4 2 3 5

Sample Output 2

YES
YES
YES
YES
YES

Alice will not reach the destination as it is, and therefore all the plans are feasible.

Sample Input 3

6 15
4 3 5 4 2 1
6
1 2 3 4 5 6

Sample Output 3

NO
NO
YES
NO
NO
YES

Solution in Rust (1.15.1) (judge verdict: Wrong Answer)

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

const MAX: i64 = 1 << 30;

fn compact(a: Vec<(i64, i64)>) -> Vec<(i64, i64)> {
    let mut ret = Vec::new();
    let mut lo = 0;
    let mut hi = -1;
    for (x, y) in a {
        if hi == -1 || hi <= x - 2 {
            if hi >= 0 {
                ret.push((lo, hi));
            }
            lo = x;
            hi = y;
        } else {
            hi = y;
        }
    }
    if hi >= 0 {
        ret.push((lo, hi));
    }
    ret
}

fn trans(a: &[(i64, i64)], b: i64) -> Vec<(i64, i64)> {
    let mut ret = Vec::new();
    for &(x, y) in a.iter() {
        if x + b <= MAX {
            ret.push((x + b, min(y + b, MAX)));
        }
        if x <= b / 2 {
            let y = min(y, b / 2);
            ret.push((x, y));
            ret.push((b - y, b - x));
        }
    }
    ret.sort();
    compact(ret)
}

fn solve() {
    let n = get();
    let dd: i64 = get();
    let d: Vec<i64> = (0 .. n).map(|_| get()).collect();
    let qn = get();
    let q: Vec<usize> = (0 .. qn).map(|_| get()).collect();
    let mut dsim = vec![dd; n + 1];
    for i in 0 .. n {
        let c = dsim[i];
        let x = min((c - d[i]).abs(), c);
        dsim[i + 1] = x;
    }
    let mut rcur = vec![(0, 0)];
    let mut poss = vec![false; n];
    for i in (0 .. n).rev() {
        // Can block dsim[i] -> rcur ?
        let mut ok = false;
        let dcur = dsim[i];
        if rcur.len() >= 1 {
            ok = rcur[0].0 >= 1 || rcur[0].1 < dcur;
        }
        poss[i] = ok;
        rcur = trans(&rcur, d[i]);
        println!("i = {}, rcur = {:?}", i, rcur);
    }
    for v in q {
        println!("{}", if poss[v - 1] { "YES" } else { "NO" });
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}