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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define allof(a) a.begin(),a.end()

typedef pair< int, int > pii;

int n, m, X[5050], Y[5050], X1[500050], X2[500050], Y1[500050], Y2[500050];

int compress(int *x) {
	vector< int > xs;
	
	for_(i,0,n) xs.push_back(x[i]);
	
	sort(allof(xs));
	xs.erase(unique(allof(xs)), xs.end());
	
	for_(i,0,n) x[i] = find(allof(xs), x[i]) - xs.begin();
	
	return xs.size();
}

int main() {
	cin >> n >> m;
	
	vector< pii > vpx, vpy;
	
	for_(i,0,n) {
		scanf("%d %d", &X[i], &Y[i]);
		vpx.push_back(pii(X[i], i));
		vpy.push_back(pii(Y[i], i));
	}
	
	sort(allof(vpx)); sort(allof(vpy));
	
	vector< int > vx, vy;
	for_(i,0,n) {
		vx.push_back(vpx[i].first);
		vy.push_back(vpy[i].first);
	}
	
	for_(i,0,m) {
		int x1, x2, y1, y2; scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
		
		int ind = lower_bound(allof(vx), x1) - vx.begin();
		X1[i] = ind < n ? vpx[ind].second : n;
		
		ind = upper_bound(allof(vx), x2) - vx.begin() - 1;
		X2[i] = ind >= 0 ? vpx[ind].second : -1;
		
		ind = lower_bound(allof(vy), y1) - vy.begin();
		Y1[i] = ind < n ? vpy[ind].second : n;
		
		ind = upper_bound(allof(vy), y2) - vy.begin() - 1;
		Y2[i] = ind >= 0 ? vpy[ind].second : -1;		
	}
	
	int W = compress(X), H = compress(Y);
	vector< vector< int > > grid(H+1, vector< int >(W+1, 0));
	
	for_(i,0,n) ++grid[Y[i]][X[i]];
	
	for_(y,0,H+1) for_(x,0,W+1) {
		if (y > 0) grid[y][x] += grid[y-1][x];
		if (x > 0) grid[y][x] += grid[y][x-1];
		if (y > 0 && x > 0) grid[y][x] -= grid[y-1][x-1];
	}
	
	for_(i,0,m) {
		int ans = 0;
		
		if (X1[i] < n && X2[i] >= 0 && Y1[i] < n && Y2[i] >= 0) {
			int x1 = X[X1[i]], x2 = X[X2[i]], y1 = Y[Y1[i]], y2 = Y[Y2[i]];
			ans += grid[y2][x2];
			if (x1-1 >= 0) ans -= grid[y2][x1-1];
			if (y1-1 >= 0) ans -= grid[y1-1][x2];
			if (x1-1 >= 0 && y1-1 >= 0) ans += grid[y1-1][x1-1];
		}
		
		printf("%d\n", ans);
	}
	
	return 0;
}