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: Accepted)

// use std::ops::{Index, IndexMut};
// use std::cmp::{Ordering, min, max};
// use std::collections::{BinaryHeap, BTreeMap};
// use std::collections::btree_map::Entry::{Occupied, Vacant};
// use std::clone::Clone;

fn getline() -> String{
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            s.trim().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let mut iter = s.trim().split(' ');
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*) 
        }
    };
}

macro_rules! readlvec {
    ($t: ty) => {
        {
            let s = getline();
            let iter = s.trim().split(' ');
            iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
        }
    }
}

macro_rules! mvec {
    ($v: expr, $s: expr) => {
        vec![$v; $s]
    };
    ($v: expr, $s: expr, $($t: expr),*) => {
        vec![mvec!($v, $($t),*); $s]
    };
}

macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

fn printiter<'a, T>(v: &'a T)
where
    &'a T: std::iter::IntoIterator, 
    <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display {
    for (i,e) in v.into_iter().enumerate() {
        if i != 0 {
            print!(" ");
        }
        print!("{}", e);
    }
    println!("");
}

struct ContestPrinter {
    s: String,
}

impl ContestPrinter {
    fn new() -> ContestPrinter {
        ContestPrinter {
            s: String::new(),
        }
    }

    fn add<T>(&mut self, x: T)
        where T: std::fmt::Display {
        self.s.push_str(format!("{}\n", x).as_str());
    }
}

impl std::ops::Drop for ContestPrinter {
    fn drop(&mut self) {
        print!("{}", self.s);
    }
}

fn main() {
    let (n, sd) = readl!(usize, i64);
    let d = readlvec!(i64);
    let qn = readl!(usize);
    let q = readlvec!(usize);
    let mut xs = vec![0; n+1];
    xs[n] = 1;
    for i in (0..n).rev() {
        if xs[i+1] <= d[i]/2 {
            xs[i] = xs[i+1];
        } else {
            xs[i] = xs[i+1]+d[i];
        }
    }
    // debug!(xs);

    use std::cmp::{min, max};
    let mut ans = Vec::with_capacity(n);
    let mut p = sd;
    for i in 0..n {
        // debug!(i); debug!(p);
        ans.push(xs[i+1] <= p);
        p = min(p, (p-d[i]).abs());
    }

    // debug!(ans);
    let mut printer = ContestPrinter::new();
    let mut s = String::new();
    for &q in &q {
        // debug!(q);
        if ans[q-1] {
            // s.push_str("YES\n");
            printer.add("YES");
        } else {
            printer.add("NO");
            // s.push_str("NO\n");
        }
    }
    // print!("{}", s);

    // let sd = sd as usize;
    // let mut dp = vec![false; sd+1];
    // dp[0] = true;
    // for &d in d.iter().rev() {
    //     let mut nex = vec![false; sd+1];
    //     for i in 0..sd+1 {
    //         nex[i] = dp[min(i, max(i as i64 - d, d - i as i64) as usize)];
    //     }
    //     dp = nex;
    //     debug!(d);
    //     for &v in &dp {
    //         if v {
    //             print!("1 ");
    //         } else {
    //             print!("0 ");
    //         }
    //     }
    //     println!("");
    // }
}