Intervals
View as PDFA closed interval  contains the integers 
. You are given 
 closed intervals 
 
, with 
 and 
 in the range 
, and 
 
 queries of the form "how many intervals contain this integer 
?" 
where 
. Determine the answer to each query.
Input Specification
Line : Two space-separated integers, 
 and 
.
Next  lines: Two space-separated integers each, 
 and 
, denoting one closed interval.
Next  lines: One integer each, denoting a single query.
Output Specification
Print the answer to each query on its own line.
Sample Input
3 10
0 3
2 4
3 7
-1
0
1
2
3
4
5
6
7
8
Sample Output
0
1
1
2
3
2
1
1
1
0
Note: In test cases worth  of the points, 
 and 
 will be in the range 
.
Comments