#include <bits/stdc++.h>
using namespace std;

const int INF = INT_MAX;
const int MAXN = 5000;
const int B = 1000;
const int BNUM = MAXN / B;

int n, m;
pair<int, int> ps[MAXN];
int x[MAXN], y[MAXN];
vector<int> bucket[BNUM];

int main() {
  while(cin >> n >> m) {
    for(int i = 0; i < n; ++i) {
      cin >> ps[i].first >> ps[i].second;
    }
    sort(ps, ps+n);
    fill(bucket, bucket + BNUM, vector<int>());
    for(int i = 0; i < n; ++i) {
      x[i] = ps[i].first;
      y[i] = ps[i].second;
      bucket[i/B].push_back(y[i]);
    }
    for(int b = 0; b < BNUM; ++b) {
      sort(bucket[b].begin(), bucket[b].end());
    }
    while(m--) {
      int s, t, u, v; cin >> s >> t >> u >> v;
      int l = lower_bound(x, x+n, s) - x;
      int r = upper_bound(x, x+n, u) - x;
      int res = 0;
      while(l < r && l % B != 0) {
        res += (t <= y[l] && y[l] <= v);
        ++l;
      }
      while(l < r && r % B != 0) {
        --r;
        res += (t <= y[r] && y[r] <= v);
      }
      while(l < r) {
        int b = l / B;
        res += upper_bound(bucket[b].begin(), bucket[b].end(), v)
          - lower_bound(bucket[b].begin(), bucket[b].end(), t);
        l += B;
      }
      cout << res << endl;
    }
  }
  return 0;
}