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

int dp[5002][5002];

map<int,int> make_zip(vector<int> v) {
    map<int,int> ret;
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    for (int i=0; i<(int)v.size(); ++i) {
        ret[v[i]] = i+1;
    }
    return ret;
}

int compress(map<int,int> &zip, int x, bool upper=true) {
    auto it = zip.lower_bound(x);
    if (it != zip.end() && it->first == x) return it->second;
    if (upper) {
        if (it == zip.end()) return -1;
        return it->second;
    } else {
        if (it == zip.end()) return zip.rbegin()->second;
        else if (it == zip.begin()) return -1;
        return (--it)->second;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    vector<int> x(n), y(n);
    for (int i=0; i<n; ++i) {
        cin >> x[i] >> y[i];
    }

    auto xzip = make_zip(x);
    auto yzip = make_zip(y);
    for (int i=0; i<n; ++i) {
        int ty = compress(yzip, y[i]);
        int tx = compress(xzip, x[i]);
        dp[ty][tx] ++;
    }
    for (int i=0; i<5001; ++i) {
        for (int j=0; j<5001; ++j) {
            dp[i+1][j+1] += dp[i+1][j] + dp[i][j+1] - dp[i][j];
        }
    }

    for (int i=0; i<m; ++i) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1 = compress(xzip, x1, true);
        y1 = compress(yzip, y1, true);
        x2 = compress(xzip, x2, false);
        y2 = compress(yzip, y2, false);
        if (x1 < 0 || y1 < 0 || x2 < 0 || y2 < 0) {
            cout << 0 << endl;
        } else {
            int cnt = dp[y2][x2] - dp[y1-1][x2] - dp[y2][x1-1] + dp[y1-1][x1-1];
            cout << cnt << endl;
        }
    }
    return 0;
}
