#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <typename T_container, typename T = typename enable_if<
                                    !is_same<T_container, string>::value,
                                    typename T_container::value_type>::type>
ostream &operator<<(ostream &os, const T_container &v) {
  os << '{';
  string sep;
  for (const T &x : v) os << sep << x, sep = ", ";
  return os << '}';
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
template <class T>
using indexed_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#ifdef LOCAL
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

#define ar array
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
#define sza(x) ((int)x.size())
#define all(a) (a).begin(), (a).end()
#define sort(a) sort(all(a))
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

const int MAX_N = 1e5 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ld EPS = 1e-9;
const char nl = '\n';
const long long int ll_MAX = 9223372036854775807;
const string deb = "------------";
//[x,y],[a,b]
int stepenDvojke(int n) {
  int s = 1;
  while (s < n) s <<= 1;
  return s;
}

void solve() {
  ll n, q;
  cin >> n >> q;
  vector<pair<ll, ll>> a(n);
  vector<ll> b(n);
  vector<pair<ll, ll>> psum(n);
  ll sum = 0;
  for (int i = 0; i < n; i++) {
    pair<ll, ll> x;
    cin >> x.first >> x.second;

    b[i] = x.first;
    a[i] = x;

    // cout<<psum[i]<<" ";
  }
  psum[0] = {0, a[0].second};
  for (int i = 1; i < n; i++) {
    ll v = 0;
    psum[i] = {
        psum[i - 1].first +
            min(a[i].first - a[i - 1].first, psum[i - 1].second),
        a[i].second + max(psum[i - 1].second - a[i].first + a[i - 1].first, v)};
  }
  //for(int i =0;i<n;i++)cout<<psum[i].first<<" "<<psum[i].second<<nl;

  for (int i = 0; i < q; i++) {
    ll x;
    cin >> x;
    ll p = lower_bound(b.begin(), b.end(), x + 1) - b.begin();
    if (p == 0)
      cout << 0 << nl;
    else {
      cout<<psum[p-1].first+min(psum[p-1].second,x-a[p-1].first+1)<<nl;
    }
  }
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  // cin >> tc;
  for (int t = 1; t <= tc; t++) {
    // cout << "Case #" << t << ": ";
    solve();
  }
}