Chemical Attack

4

1 votes
Easy-Medium
Problem

Army is on a mission to attack the terrorists with missiles.There are various chemicals available in the market for this purpose.The making of the explosive takes K days.Scientists need chemicals numbered L to R on ith day.Colonel V.K.Singh is given the chart of the range of chemicals on K days.He has questions in his mind how many times will the Xth chemical be needed in these days.Being a good citizen of the country show some respect towards Colonel V.K.Singh by helping him answer his questions.

Input

First line of input contains 2 integers K and Q indicating number of days and Q questions respectively. K lines follow having 2 integers L and R indicating start and the end index of the chemical required. Next Q lines follow having an integer X indicating the question of Colonel for Xth chemical.

Ouptput

Output Q lines corresponding to the answer.

Contraints

1<=K<=10^5

1<=Q<=10^5

1<=L<=R<=10^5

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Consider the third query where X =5.

5 is present in day3 requirements i.e, [3 ,5] and day4 i.e, [2,5].

So answer for X=5 is 2.

Editor Image

?