#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int a[N + 5];
int b[N + 5];
int c[N + 5];
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    if (fopen("WAITING.INP", "r")) {
        freopen("WAITING.INP", "r", stdin);
        freopen("WAITING.OUT", "w", stdout);
    }
    int n, m;
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
        cin >> b[i];
    }
    for(int i = 1; i <= m; i++){
        cin >> c[i];
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for(int i = 1; i <= m; i++){
        int x = upper_bound(b + 1, b + n + 1, c[i]) - b;
        if(x > n){
            cout << -1 << "\n";
        }else{
            cout << max(0, a[x] - c[i]) << "\n";
        }
    }
    return 0;
}
