There is an infinitely long street that runs west to east, which we consider as a number line.

There are N roadworks scheduled on this street. The i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.

Q people are standing at coordinate 0. The i-th person will start the coordinate 0 at time D_i, continue to walk with speed 1 in the positive direction and stop walking when reaching a blocked point.

Find the distance each of the Q people will walk.

Constraints

* All values in input are integers.
* 1 \leq N, Q \leq 2 \times 10^5
* 0 \leq S_i < T_i \leq 10^9
* 1 \leq X_i \leq 10^9
* 0 \leq D_1 < D_2 < ... < D_Q \leq 10^9
* If i \neq j and X_i = X_j, the intervals [S_i, T_i) and [S_j, T_j) do not overlap.

Input

Input is given from Standard Input in the following format:


N Q
S_1 T_1 X_1
:
S_N T_N X_N
D_1
:
D_Q


Output

Print Q lines. The i-th line should contain the distance the i-th person will walk or -1 if that person walks forever.

Example

Input

4 6
1 3 2
7 13 10
18 20 13
3 4 2
0
1
2
3
5
8


Output

2
2
10
-1
13
-1
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] first = br.readLine().split(" ", 2);
        int n = Integer.parseInt(first[0]);
        int q = Integer.parseInt(first[1]);
        PriorityQueue<Event> events = new PriorityQueue<Event>(new Comparator<Event>() {
            public int compare(Event e1, Event e2) {
                return e1.targets() - e2.targets();
            }
        });
        for (int i = 0; i < n; i++) {
            events.add(new Event(i, br.readLine()));
        }
        Person[] persons = new Person[q];
        for (int i = 0;  i < q; i++) {
            persons[i] = new Person(i, br.readLine());
        }
        Arrays.sort(persons);
        TreeSet<Event> currents = new TreeSet<>();
        PriorityQueue<Event> endQueue = new PriorityQueue<Event>(new Comparator<Event>() {
            public int compare(Event e1, Event e2) {
                return e1.targete() - e2.targete();
            }
        });
        int[] ans = new int[q];
        for (int i = 0; i < q; i++) {
            while (events.size() > 0 && events.peek().targets() <= persons[i].place) {
                Event e = events.poll();
                endQueue.add(e);
                currents.add(e);
            }
            while (endQueue.size() > 0 && endQueue.peek().targete() <= persons[i].place) {
                currents.remove(endQueue.poll());
            }
            if (currents.size() == 0) {
                ans[persons[i].idx] = -1;
            } else {
                ans[persons[i].idx] = currents.first().place;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < q; i++) {
            sb.append(ans[i]).append("\n");
        }
        System.out.print(sb);
    }
    
    static class Event implements Comparable<Event> {
        int start;
        int end;
        int place;
        int idx;
        
        public Event(int idx, String str) {
            this.idx = idx;
            String[] arr = str.split(" ", 3);
            start = Integer.parseInt(arr[0]);
            end = Integer.parseInt(arr[1]);
            place = Integer.parseInt(arr[2]);
        }
        
        public int compareTo(Event another) {
            if (place == another.place) {
                return idx - another.idx;
            } else {
                return place - another.place;
            }
        }
        
        public int hashCode() {
            return idx;
        }
        
        public boolean equals(Object o) {
            Event e = (Event) o;
            return this.idx == e.idx;
        }
        
        public int targets() {
            return start - place;
        }
        
        public int targete() {
            return end - place;
        }
        
        public String toString() {
            return idx + ":" + targets() + ":" + targete() + ":" + place;
        }
    }
    
    static class Person implements Comparable<Person> {
        int idx;
        int place;
        
        public Person(int idx, int place) {
            this.idx = idx;
            this.place = place;
        }
        
        public Person(int idx, String str) {
            this(idx, Integer.parseInt(str));
        }
        
        public int compareTo(Person another) {
            return place - another.place;
        }
    }
}