Demilitarized Zone

For each protected point, count how many starting mines eventually trigger a blast covering it, given chain reactions over intervals.

Hard8IntervalsSortingSegment treeGraphNo attempts yetTime limit3sMemory limit256 MB

Problem

In the year 12117, South Korea and North Korea declared unification in honor of Choi Seokhwan (gs12117), a great intellectual of the Korean Peninsula. General Lee Wonhyung of the Republic of Korea (no relation to the Lee Wonhyung born in 1998) is a great soldier in charge of his country's cyber defense. He is now working out how to clear the mines buried in the demilitarized zone.

The demilitarized zone is modeled as a number line from 00 to 10910^9. Exactly NN mines are buried in it, and mine ii is at position XiX_i. A mine explodes when a disturbance is detected at its position XiX_i.

Many kinds of bombs are buried there, including nuclear mines and Galaxy Note 7s, so each mine explodes differently. Mine ii explodes a distance LiL_i to the left and RiR_i to the right, which means its blast range is the closed interval [XiLi,Xi+Ri][X_i - L_i, X_i + R_i]. Explosions set off chain reactions: if the position of a mine that has not exploded yet lies inside a blast range, that mine explodes too.

General Lee plans to detonate one mine as a test. The demilitarized zone, however, is home to many cultural heritage sites and endangered animals, and the general wants to survey the area first to protect them as much as possible. He has designated MM protected areas, and protected area jj is at position CjC_j. For each protected area, he wants to know how many mines can destroy it. A mine can destroy a protected area if, when only that mine is detonated at the start, the protected area lies inside the blast range of at least one exploded mine once the chain reaction ends.

In his youth General Lee was a celebrated competitor in the Korea Olympiad in Informatics (KOI), but now he is far too busy preparing an address to the nation. Solve the problem for him.

Input

The first line contains the number of mines NN and the number of protected areas MM. (1N1061 \le N \le 10^6, 1M3000001 \le M \le 300\,000)

Each of the next NN lines describes one mine. The ii-th of these lines contains three integers XiX_i, LiL_i, and RiR_i: the position of mine ii and its blast distances to the left and to the right. (0Xi1090 \le X_i \le 10^9, 1Li,Ri1091 \le L_i, R_i \le 10^9)

Each of the next MM lines contains one integer CjC_j, the position of protected area jj. (0Cj1090 \le C_j \le 10^9)

Output

Print MM lines. The jj-th line contains the number of mines that can destroy protected area jj.

Hint

In the example, no mine can destroy the protected area at position 101101.

The protected area at position 100100 is destroyed when mine 44 explodes. Detonating any one of mines 11, 22, and 44 at the start eventually makes mine 44 explode.

The protected area at position 00 is destroyed when mine 22 explodes. Mine 22 explodes only if mine 22 itself is detonated at the start.

The protected area at position 1414 is destroyed when any of mines 11, 33, and 44 explodes. Whichever of mines 11 to 44 is detonated at the start, one of these three mines explodes. So the protected area is destroyed no matter which mine is detonated.