unittest
{
	assert( [ "3 70", "7 60", "1 80", "4 50" ].parse.expand.solve == "4" );
	assert( [ "4 3", "1 1000", "2 4", "3 1000", "4 500" ].parse.expand.solve == "TLE" );
	assert( [ "5 9", "25 8", "5 9", "4 10", "1000 1000", "6 1" ].parse.expand.solve == "5" );
}



import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nt = input.front.split.to!( long[] );
	auto cts = new long[ 2 ][ nt[ 0 ] ];
	foreach( ref ct; cts )
	{
		input.popFront;
		ct = input.front.split.to!( long[] );
	}
	return tuple( nt[ 1 ], cts );
}

auto solve( long t, long[ 2 ][] cts )
{
	auto c = long.max;
	foreach( i, ct; cts )
	{
		if( ct[ 1 ] <= t && ct[ 0 ] < c ) c = ct[ 0 ];
	}
	if( c < long.max ) return c.to!string;
	else               return "TLE";
}
