#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int64_t LowClamp(int64_t v)
{
	return max(0LL, v);
}

int main()
{
	int N,Q;
	cin >> N;
	cin >> Q;
	vector<pair<int64_t, int64_t>> TimeBought;
	vector<int64_t> Questions;
	for (int i = 0; i < N; ++i)
	{
		int64_t t,t1;
		cin >> t;
		cin >> t1;
		TimeBought.emplace_back(t,t1);
	}
	for (int i = 0; i < Q; ++i)
	{
		int64_t t;
		cin >> t;
		Questions.push_back(t);
	}

	for (int64_t question : Questions)
	{
		int64_t day_limit = question;
		int64_t ate = 0;
		int64_t last_day = 0;

		int64_t day_delta; 
		int64_t budget = 0;
		for (int i = 0; i < N; ++i)
		{
			if (TimeBought[i].first <= day_limit)
			{
				day_delta = TimeBought[i].first - (last_day - 1);

				auto oldb = budget;
				budget = LowClamp(budget - day_delta);
				auto db = oldb - budget;
				ate += db;

				
				last_day = TimeBought[i].first;
				budget += TimeBought[i].second;
			}
			else
			{
				break;
			}
		}
		day_delta = day_limit - (last_day - 1);
		auto oldb = budget;
		budget = LowClamp(budget - day_delta);
		auto db = oldb - budget;
		ate += db;
		cout << ate << "\n";
	}
}