// https://atcoder.jp/contests/abc128/tasks/abc128_e

// https://qiita.com/penguinshunya/items/cd96803b74635aebefd6
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
fn read_vec_lines<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
struct WSTuple2<T1, T2>((T1, T2)); // White Space Tuple
impl<T1, T2> std::str::FromStr for WSTuple2<T1, T2>
where
    T1: std::str::FromStr,
    T2: std::str::FromStr,
{
    type Err = (); // should be never type "!"
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let vec: Vec<String> = s.split_whitespace().take(2).map(String::from).collect();
        Ok(WSTuple2((
            vec[0].parse().ok().unwrap(),
            vec[1].parse().ok().unwrap(),
        )))
    }
}
struct WSTuple3<T1, T2, T3>((T1, T2, T3)); // White Space Tuple
impl<T1, T2, T3> std::str::FromStr for WSTuple3<T1, T2, T3>
where
    T1: std::str::FromStr,
    T2: std::str::FromStr,
    T3: std::str::FromStr,
{
    type Err = (); // should be never type "!"
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let vec: Vec<String> = s.split_whitespace().take(3).map(String::from).collect();
        Ok(WSTuple3((
            vec[0].parse().ok().unwrap(),
            vec[1].parse().ok().unwrap(),
            vec[2].parse().ok().unwrap(),
        )))
    }
}
struct WSTuple4<T1, T2, T3, T4>((T1, T2, T3, T4)); // White Space Tuple
impl<T1, T2, T3, T4> std::str::FromStr for WSTuple4<T1, T2, T3, T4>
where
    T1: std::str::FromStr,
    T2: std::str::FromStr,
    T3: std::str::FromStr,
    T4: std::str::FromStr,
{
    type Err = (); // should be never type "!"
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let vec: Vec<String> = s.split_whitespace().take(3).map(String::from).collect();
        Ok(WSTuple4((
            vec[0].parse().ok().unwrap(),
            vec[1].parse().ok().unwrap(),
            vec[2].parse().ok().unwrap(),
            vec[3].parse().ok().unwrap(),
        )))
    }
}

/// Find the first element that satisfies cond, where cond is a lower-bound condition on vec.
/// Returns end if no element satisfies cond.
fn find_first_satisfy<T>(vec: &Vec<T>, start: usize, end: usize, cond: &Fn(&T) -> bool) -> usize {
    assert_ne!(start, end);
    if end - start == 1 {
        if cond(&vec[start]) {
            start
        } else {
            vec.len()
        }
    } else {
        let mid = start + (end - start) / 2;
        if cond(&vec[mid]) {
            std::cmp::min(find_first_satisfy(vec, start, mid, cond), mid)
        } else {
            find_first_satisfy(vec, mid, end, cond)
        }
    }
}

fn main() {
    let (n, q) = read::<WSTuple2<i32, i32>>().0;
    struct RoadWork {
        start: i32,
        end: i32,
        position: i32,
    }
    let mut road_works: Vec<RoadWork> = vec![];
    for _ in 0..n {
        let (si, ti, xi) = read::<WSTuple3<i32, i32, i32>>().0;
        road_works.push(RoadWork {
            start: si - xi,
            end: ti - 1 - xi,
            position: xi,
        });
    }
    let mut dis: Vec<i32> = vec![];
    for _ in 0..q {
        let di = read::<i32>();
        dis.push(di);
    }
    dis.sort();
    let mut tree: Vec<Vec<i32>> = vec![];
    let mut q2 = 1i32;
    loop {
        tree.push(vec![std::i32::MAX; q2 as usize]);
        if q2 >= q {
            break;
        }
        q2 = q2 * 2;
    }
    debug_assert_eq!(2i32.pow(tree.len() as u32 - 1), q2);
    for _ in q..q2 {
        dis.push(std::i32::MAX);
    }
    debug_assert_eq!(dis.len(), q2 as usize);
    let tree_depth = tree.len();
    let idx_in_level = |level: usize, idx: i32| -> usize {
        (idx / 2i32.pow((tree_depth - 1 - level) as u32)) as usize
    };
    for road_work in &road_works {
        let idx_start =
            find_first_satisfy(&dis, 0, dis.len(), &|q: &i32| *q >= road_work.start) as i32;
        let idx_end = find_first_satisfy(&dis, 0, dis.len(), &|q: &i32| *q > road_work.end) as i32;
        let mut idx = idx_start;
        while idx < idx_end {
            let mut level_width: Option<(usize, i32)> = None;
            for i in 0..tree.len() {
                let width = q2 / 2i32.pow(i as u32);
                if idx % width == 0 && idx + width <= idx_end {
                    level_width = Some((i, width));
                    break;
                }
            }
            let (level, width) = level_width.unwrap();
            let idx_in_level = idx_in_level(level, idx);
            tree[level][idx_in_level] =
                std::cmp::min(tree[level][idx_in_level], road_work.position);
            idx += width;
        }
    }
    for idx in 0..q {
        let mut min = std::i32::MAX;
        for level in 0..tree.len() {
            let idx_in_level = idx_in_level(level, idx);
            min = std::cmp::min(min, tree[level][idx_in_level]);
        }
        if min == std::i32::MAX {
            println!("-1");
        } else {
            println!("{}", min);
        }
    }
}


Measured memory_bytes: 12036