unittest
{
	assert( [ "4 6", "1 3 2", "7 13 10", "18 20 13", "3 4 2", "0", "1", "2", "3", "5", "8" ].parse.expand.solve == "2\n2\n10\n-1\n13\n-1" );
}



import std.algorithm;
import std.conv;
import std.container;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nq = input.front.split.to!( long[] );
	auto stxs = new long[ 3 ][ nq[ 0 ] ];
	foreach( ref stx; stxs )
	{
		input.popFront;
		stx = input.front.split.to!( long[] );
	}
	auto ds = new long[ nq[ 1 ] ];
	foreach( ref d; ds )
	{
		input.popFront;
		d = input.front.to!( long );
	}
	return tuple( stxs, ds );
}

auto solve( long[ 3 ][] stxs, long[] ds )
{
	auto es = new Tuple!( long, bool, long )[ stxs.length * 2 ];
	foreach( i, stx; stxs )
	{
		es[ i               ] = tuple( stx[ 0 ] - stx[ 2 ], true,  stx[ 2 ] );		// 工事はじまる
		es[ i + stxs.length ] = tuple( stx[ 1 ] - stx[ 2 ], false, stx[ 2 ] );		// 工事おわる
	}
	es.sort();
	
	auto anss = new long[ ds.length ];
	auto rbt = new RedBlackTree!( long );
	foreach( ref ans, d; lockstep( anss, ds ) )
	{
		while( !es.empty && es.front[ 0 ] <= d )
		{
			if( es.front[ 1 ] ) rbt.insert( es.front[ 2 ] );
			else                rbt.removeKey( es.front[ 2 ] );
			es.popFront;
		}
		if( rbt.empty ) ans = -1;
		else            ans = rbt.front;
	}
	return anss.to!( string[] ).join( "\n" );
}
