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.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

        int n=sc.nextInt();
        int q=sc.nextInt();
        P p[]=new P[q+n*2];
        int c=0;
        int d[]=new int[n];
        for (int i = 0; i < n; i++) {
        	int s=sc.nextInt();
        	int t=sc.nextInt();
        	int x=sc.nextInt();
        	d[i]=x;
			p[c++]=new P(i,s-x,1 );
			p[c++]=new P(i,t-x,0);
		}
        
        for (int i = 0; i < q; i++) {
			p[c++]= new P(-1, sc.nextInt(), 2 );
		}
        sort(p);
        boolean u[] = new boolean[n];
        PriorityQueue<Q> l = new PriorityQueue<>(); 

        for (int i = 0; i < p.length; i++) {
			if(p[i].w==1) {u[p[i].id]=true; l.add(new Q(p[i].id, d[p[i].id]));}
			else if(p[i].w==0)u[p[i].id]=false;
			else {
				while(!l.isEmpty() && !u[l.peek().id]) {
					l.poll();
				}
				if(l.isEmpty()) {
			        out.println(-1);
				}
				else {
					out.println(l.peek().x);
				}
			}
		}

        out.println();
        out.flush();
    }
    



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

class P implements Comparable<P>{
	int x,w,id,ox;
	P(int id, int x, int w) {
		this.id=id;
		this.x=x;
		this.w=w;
	}

	public int compareTo(P p){
		if(x==p.x) {
			return w-p.w;
		}
		return x-p.x;
	}
}

class Q implements Comparable<Q>{
	int x,id;
	Q(int id, int x) {
		this.id=id;
		this.x=x;
	}

	public int compareTo(Q p){
		return x-p.x;
	}
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}
