#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <complex>
#include <map>
#include <unordered_map>
using namespace std;
vector <pair<int, in>> a;
vector <pair <int, int>> all;
vector <int> p;
multiset <int> point, l, r;
map <int, int> ans;
int main()
{
int c, b, n, m;
cin >> n >> m;
for (int i = 0; i < n; i++)
{
cin >> c >> b;
all.push_back({ max(b, c), 2 });
all.push_back({ min(b, c), 0 });
}
int x;
for (int i = 0; i < m; i++)
{
cin >> x;
p.push_back(x);
all.push_back({ x, 1 });
}
sort(all.begin(), all.end());
int count = 0;
for (auto i : all) {
if (i.second == 0)count++;
if (i.second == 1)ans[i.first] = max(ans[i.first], count);
if (i.second == 2)count--;
}
for (auto i : p)
cout << ans[i] << ' ';
}
I2luY2x1ZGUgPGFsZ29yaXRobT4gCiNpbmNsdWRlIDxpb3N0cmVhbT4gCiNpbmNsdWRlIDx2ZWN0b3I+IAojaW5jbHVkZSA8c2V0PiAKI2luY2x1ZGUgPGNtYXRoPiAKI2luY2x1ZGUgPGNvbXBsZXg+IAojaW5jbHVkZSA8bWFwPiAKI2luY2x1ZGUgPHVub3JkZXJlZF9tYXA+IAoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsgCgp2ZWN0b3IgPHBhaXI8aW50LCBpbj4+IGE7IAp2ZWN0b3IgPHBhaXIgPGludCwgaW50Pj4gYWxsOyAKdmVjdG9yIDxpbnQ+IHA7IAptdWx0aXNldCA8aW50PiBwb2ludCwgbCwgcjsgCm1hcCA8aW50LCBpbnQ+IGFuczsgCgppbnQgbWFpbigpIAp7IAppbnQgYywgYiwgbiwgbTsgCmNpbiA+PiBuID4+IG07IApmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgCnsgCmNpbiA+PiBjID4+IGI7IAphbGwucHVzaF9iYWNrKHsgbWF4KGIsIGMpLCAyIH0pOyAKYWxsLnB1c2hfYmFjayh7IG1pbihiLCBjKSwgMCB9KTsgCn0gCmludCB4OyAKZm9yIChpbnQgaSA9IDA7IGkgPCBtOyBpKyspIAp7IApjaW4gPj4geDsgCnAucHVzaF9iYWNrKHgpOyAKYWxsLnB1c2hfYmFjayh7IHgsIDEgfSk7IAp9IApzb3J0KGFsbC5iZWdpbigpLCBhbGwuZW5kKCkpOyAKaW50IGNvdW50ID0gMDsgCmZvciAoYXV0byBpIDogYWxsKSB7IAppZiAoaS5zZWNvbmQgPT0gMCljb3VudCsrOyAKaWYgKGkuc2Vjb25kID09IDEpYW5zW2kuZmlyc3RdID0gbWF4KGFuc1tpLmZpcnN0XSwgY291bnQpOyAKaWYgKGkuc2Vjb25kID09IDIpY291bnQtLTsgCn0gCmZvciAoYXV0byBpIDogcCkKY291dCA8PCBhbnNbaV0gPDwgJyAnOyAKfQog
prog.cpp:12:19: error: ‘in’ was not declared in this scope
vector <pair<int, in>> a;
^~
prog.cpp:12:19: error: template argument 2 is invalid
prog.cpp:12:21: error: template argument 1 is invalid
vector <pair<int, in>> a;
^~
prog.cpp:12:21: error: template argument 2 is invalid