//***** author: attacker *****//
//***** created: 24.04.2026 10:12:27 *****//
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 1
#endif
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define bpc __builtin_popcount
#define size(v) (int) (v.size())
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, q;
cin >> n >> q;
vector<pair<int, int>> a(n);
for (auto& [x, y] : a) {
cin >> x >> y;
}
while (q--) {
int d, h;
cin >> d >> h;
vector<pair<int, int>> v;
for (auto [x, y] : a) {
if (x >= d && y <= h) {
v.push_back({x, y});
}
}
int res = (int) 1e9;
for (int mask = 0; mask < (1 << size(v)); mask++) {
vector<pair<int, int>> vt;
for (int i = 0; i < size(v); i++) {
if (mask & (1 << i)) {
vt.push_back(v[i]);
}
}
sort(vt.begin(), vt.end());
do {
bool fail = false;
for (int i = 1; i < size(vt); i++) {
if (!(vt[i - 1].first > vt[i].first && vt[i - 1].second > vt[i].second)) {
fail = true;
break;
}
}
if (!fail) {
res = min(res, size(v) - size(vt) + 1);
}
} while (next_permutation(vt.begin(), vt.end()));
}
}
return 0;
}