#include <iostream>
#include <unordered_map>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <queue>
#include <fstream>
#include <random>
#include <stack>

using namespace std;


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    /*int t;
    std::cin >> t;
    for (int iter = 0; iter < t; iter++) {
        long long l, r, k;
        std::cin >> l >> r >> k;
        
        long long p = r / k;
        long long res = (p - l + 1);
        if (res < 0) res = 0;
        std::cout << res << std::endl;
        
    }*/

    std::vector<long long> arr;
    std::vector<long long> stock, eat;
    long long n, q;
    std::cin >> n >> q;
    for (int i = 0; i < n; i++) {
        long long d, p;
        std::cin >> d >> p;
        
        arr.push_back(d);
        if (i == 0) stock.push_back(p);
        else stock.push_back(std::max(stock[i - 1] - (arr[i] - arr[i-1]), 0ll) + p);
        if (i == 0) eat.push_back(0);
        else eat.push_back(eat[i-1] + std::min(stock[i - 1], (arr[i] - arr[i - 1])));
    }
    /*for (int i = 0; i < n; i++) {
        std::cout << stock[i] << " ";
    }
    std::cout << std::endl;
    for (int i = 0; i < n; i++) {
        std::cout << eat[i] << " ";
    }
    std::cout << std::endl;*/
    for (int i = 0; i < q; i++) {
        long long a;
        std::cin >> a;
        long long j = std::upper_bound(arr.begin(), arr.end(), a) - arr.begin();
        j--;
        if (j < 0) {
            std::cout << 0 << std::endl;
            continue;
        }
        //std::cout << j << std::endl;
        //std::cout << j << " " << prefix[j - 1] << " " << plg[j] << " " << (a-j + 1) << std::endl;
        long long res = eat[j] + std::min(stock[j], (a - arr[j]) + 1);
        std::cout << res << std::endl;
    }

    return 0;
}