#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

struct St {
	int x1;
	int y1;
	int x2;
	int y2;
};

St r[500001];
int imos[5001][5001];
int main()
{
	int n, m;
	vector<int> x, y;
	vector<int> vx, vy;
	cin >> n >> m;
	REP(i, 0, n) {
		int xx, yy;
		cin >> xx >> yy;
		x.push_back(xx);
		y.push_back(yy);
		vx.push_back(xx);
		vy.push_back(yy);
	}
	REP(i, 0, m) {
		cin >> r[i].x1 >> r[i].y1 >> r[i].x2 >> r[i].y2;
	}

	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	x.erase(unique(x.begin(), x.end()), x.end());
	y.erase(unique(y.begin(), y.end()), y.end());

	REP(i, 0, n + 1) imos[i][0] = imos[0][i] = 0;
	REP(i, 0, n) {
		int tx = lower_bound(x.begin(), x.end(), vx[i]) - x.begin();
		int ty = lower_bound(y.begin(), y.end(), vy[i]) - y.begin();
		++imos[ty + 1][tx + 1];
	}

	REP(i, 0, y.size()) {
		REP(j, 0, x.size()) {
			imos[i + 1][j + 1] += imos[i + 1][j] + imos[i][j + 1] - imos[i][j];
		}
	}

	REP(i, 0, m) {
		int xx1, yy1, xx2, yy2;
		xx1 = lower_bound(x.begin(), x.end(), r[i].x1) - x.begin();
		yy1 = lower_bound(y.begin(), y.end(), r[i].y1) - y.begin();
		xx2 = lower_bound(x.begin(), x.end(), r[i].x2 + 1) - x.begin();
		yy2 = lower_bound(y.begin(), y.end(), r[i].y2 + 1) - y.begin();

		cout << imos[yy2][xx2] - imos[yy2][xx1] - imos[yy1][xx2] + imos[yy1][xx1] << endl;
	}

	return 0;
}