using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using static System.Console;
using static System.Math;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		int[] s=sc.Ia;
		int[][] a=new int[s[0]][];
		int[] b=new int[s[1]+1];
		for(int i = 0;i<s[0];i++) {
			a[i]=sc.Ia;
			int q=a[i][1]-a[i][2]-1;
			if(q>=0){
				a[i][1]=q;
				q=Max(a[i][0]-a[i][2],0);
				a[i][0]=q;
			}
			else{a[i][2]=-1;}
		}
		for(int i = 0;i<s[1];i++) {b[i]=sc.I;}
		Array.Sort(a,(u,v)=>v[2]-u[2]);
		St2 st=new St2(0,s[1]);
		for(int i = 0;i<s[0]&&a[i][2]!=-1;i++) {
			int lb=-1,ub=s[1],mid=0;
			while(ub-lb>1){
				mid=(ub+lb)/2;
				if(b[mid]>=a[i][0]){ub=mid;}
				else{lb=mid;}
			}
			int p=ub;
			lb=-1;ub=s[1];mid=0;
			while(ub-lb>1){
				mid=(ub+lb)/2;
				if(b[mid]>=a[i][1]+1){ub=mid;}
				else{lb=mid;}
			}
			if(p!=s[1]&&lb!=-1){st.Ud3(p,lb,a[i][2]);}
		}
		StringBuilder sb=new StringBuilder();
		for(int i = 0;i<s[1];i++) {
			long q=st.Get(i,i);
			sb.Append((q==0?-1:q)+"\n");
		}
		Write(sb);
	}
}
public class St2{
	public long[] dat,dat3;
	private bool[] bo3;
	private int m=1,f,sr=1,cnt=0;
	public St2(int f,int n){
		this.f=f;n+=f^1;
		while(m<n){m*=2;sr+=sr;}
		cnt=m+n-1;
		dat=new long[cnt];
		dat3=new long[cnt+1];
		bo3=new bool[cnt];
	}
	private long Fdg(int a,int b,int k,int l,int r){
		if(k>=cnt){return 0;}
		if(bo3[k]){
			dat[k]=dat3[k];
			if(2*k+1<cnt){dat3[2*k+1]=dat3[k]>>1;bo3[2*k+1]=true;}
			if(2*k+2<cnt){dat3[2*k+2]=dat3[k]>>1;bo3[2*k+2]=true;}
			bo3[k]=false;
		}
		if(r<a||b<l){return 0;}
		if(a<=l&&r<=b){return dat[k];}
		else{return Fdg(a,b,k*2+1,l,(l+r)>>1)+Fdg(a,b,k*2+2,(l+r+1)>>1,r);}
	}
	public long Get(int a,int b){return Fdg(a,b,0,f,m-(f^1));}
	public void Ud3(int a,int b,long d){Hn3(a,b,0,f,m-(f^1),d*sr);}
	private long Hn3(int a,int b,int k,int l,int r,long d){
		if(k>=cnt){return 0;}
		if(a<=l&&r<=b){dat3[k]=d;bo3[k]=true;return d;}
		if(bo3[k]){
			dat[k]=dat3[k];
			if(2*k+1<cnt){dat3[2*k+1]=dat3[k]>>1;bo3[2*k+1]=true;}
			if(2*k+2<cnt){dat3[2*k+2]=dat3[k]>>1;bo3[2*k+2]=true;}
			bo3[k]=false;
		}
		if(r>=a&&b>=l){
			dat[k]=Hn3(a,b,k*2+1,l,(l+r)>>1,d>>1)+Hn3(a,b,k*2+2,(l+r+1)>>1,r,d>>1);
			return dat[k];
		}
		return dat[k];
	}
}

public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=ReadLine().Split();}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=ReadLine().Split();}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=ReadLine().Split();}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=ReadLine().Split();}n++;return a[n];}}
	public string Sz{get{return ReadLine();}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(ReadLine().Split(),int.Parse);}}
	public int[] Ia2(int b){return Array.ConvertAll((((b&1)!=0?"0 ":"")+ReadLine()+((b&2)!=0?" 0":"")).Split(),int.Parse);}
	public long[] La{get{return Array.ConvertAll(ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+ReadLine()+" 0").Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return ReadLine().Split();}}
	public string[] Sa2{get{return (ReadLine()+" 0").Split();}}
}


Measured memory_bytes: 43604