#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

using P = pair<int, int>;

int idx(vector<int> const& v, int i) {
    return lower_bound(v.begin(), v.end(), i) - v.begin();
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> sum(n+2, vector<int>(n+2));
    vector<int> xs(n), ys(n);
    vector<int> x(n), y(n);
    for(int i=0; i<n; ++i) {
        cin >> x[i] >> y[i];
        xs[i] = x[i];
        ys[i] = y[i];
    }
    sort(x.begin(), x.end());
    x.erase(unique(x.begin(), x.end()), x.end());
    sort(y.begin(), y.end());
    y.erase(unique(y.begin(), y.end()), y.end());

    for(int i=0; i<n; ++i) {
        int tx = idx(x, xs[i]);
        int ty = idx(y, ys[i]);
        ++sum[ty+1][tx+1];
    }
    for(int i=0; i<y.size(); ++i) {
        for(int j=0; j<x.size(); ++j) {
            sum[i+1][j+1] += sum[i+1][j] + sum[i][j+1] - sum[i][j];
        }
    }

    for(int i=0; i<m; ++i) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1 = idx(x, x1);
        y1 = idx(y, y1);
        x2 = idx(x, x2+1);
        y2 = idx(y, y2+1);
        cout << sum[y2][x2] - sum[y2][x1] - sum[y1][x2] + sum[y1][x1] << endl;
    }
}
