#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define all(v) v.begin(), v.end()
void solve() {
int n, q; cin >> n >> q;
vector<pair<int, int>> vt;
for(int i = 1; i <= n; i++) {
int r, h; cin >> r >> h;
vt.pb({r, h});
}
while(q--) {
int a, b; cin >> a >> b;
vector<pair<int, int>> vt2;
for(int i = 0; i < n; i++) {
if(vt[i].first >= a and vt[i].second <= b) {
vt2.pb(vt[i]);
// cout << vt[i].first << ' ' << vt[i].second << '\n';
}
}
if(!vt2.size()) {
cout << "0\n";
continue;
}
sort(all(vt2));
int maxi = -1;
do {
int cnt = 0;
pair<int, int> curr = {-1, -1};
for(int i = 0; i < vt2.size(); i++) {
if(curr.first == -1) {
curr = vt2[i];
// cout << curr.first << ' ' << curr.second << ' ';
}
else {
if(curr.first < vt2[i].first and curr.second < vt2[i].second) {
curr = vt2[i], cnt++;
// cout << vt2[i].first << ' ' << vt2[i].second << ' ';
}
}
}
maxi = max(maxi, cnt);
} while(next_permutation(all(vt2)));
cout << vt2.size() - maxi << '\n';
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T = 1;
//cin >> T;
while (T--) solve();
}