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


const int MAX_N = 1 << 15;
struct Wavelet{
	void init(vector<ll> A){
		N = 1;
		while(N < A.size()) N *= 2;
		while(A.size() != N) A.push_back(1LL << 50);
		sorted = A;
		sort(sorted.begin(), sorted.end());
		for(int i = 0; i < N; i++){
			b[0][i] = A[i];
		}
		for(int len = N, d = 0; len >= 1; len /= 2, d++){
			int g = 0;
			for(int l = 0; l < N; l += len){
				calc(l, l + len, d);
				for(int i = l; i < l + len; i++){
					group[d][i] = g;
					if(i != l) Left[d][i] += Left[d][i - 1];
				}
				g++;
			}
		}
	}
	// [l,r)????????????????????¨??????k??????(1-indexed)??????
	ll  kth_element(int l, int r, int k){
		return kth_element(l, r, k, 0, N, 0);
	}
	/*
	[l,r)????????????????????¨???x????????????(1-index)?????\??????.
	x???2?????\???????????¨??????,??????????????????rank?????????.
	x???????????¨??????x????????§?????§????????????rank?????????.
	x?????????????????¨??????0?????????.
	*/
	int pos(int l, int r, ll x){
		return pos(l, r, x, 0, N, 0);
	}
	// [l,r)???x?????°
	int freq(int l, int r, ll x){
		return pos(l, r, x) - pos(l, r, x - 1);
	}
	// [l,r)???lx??\???rx??\????????°(?)
	int freq2(int l, int r, ll lx, ll rx){
		return pos(l, r, rx) - pos(l, r, lx - 1);
	}
private:
	int N;
	vector<ll> sorted;
	ll b[25][MAX_N];
	int Left[25][MAX_N];
	int group[25][MAX_N];

	int getLeftNum(int l, int r, int d){
		if(r <= l) return 0;
		int ret = Left[d][r - 1];
		if(l && group[d][l - 1] == group[d][r - 1]) ret -= Left[d][l - 1];
		return ret;
	}

	void calc(int l, int r, int d){
		int c = (l + r) / 2, len = r - l;
		vector<ll> v(b[d] + l, b[d] + r);
		sort(v.begin(), v.end());
		map<ll, int> lcnt;
		for(int i = 0; i < len / 2; i++){
			lcnt[v[i]]++;
		}
		int L = l, R = c;
		for(int i = l; i < r; i++){
			ll val = b[d][i];
			if(lcnt.count(val) && lcnt[val]){
				lcnt[val]--;
				b[d + 1][L] = val;
				L++;
				Left[d][i] = 1;
			}
			else{
				b[d + 1][R] = val;
				R++;
				Left[d + 1][i] = 0;
			}
		}
	}
	// ??±??????d??§[L,R)?????¨?????????????????¨??????[l,r)???k??????(1-indexed)??????
	ll kth_element(int l, int r, int k, int L, int R, int d){
		if(R - L == 1) return b[d][L];
		int len = r - l, mid = (L + R) / 2;
		// [l,r)????????§???????????????????????°
		int leftNum = getLeftNum(l, r, d), rightNum = len - leftNum;
		// ???????????????????????°???k??\????????????????????°???????????§???????????????????????°
		if(k <= leftNum){
			int newl = max(L, L + getLeftNum(L, l, d));
			int newr = min(mid, newl + leftNum);
			return kth_element(newl, newr, k, L, mid, d + 1);
		}
		else{
			int newl = max(mid, mid + (l - L - getLeftNum(L, l, d)));
			int newr = min(R, newl + rightNum);
			return kth_element(newl, newr, k - leftNum, mid, R, d + 1);
		}
	}
	int pos(int l, int r, ll x, int L, int R, int d){
		if(R - L == 1){
			return l + 1 == r && sorted[l] <= x;
		}
		int mid = (L + R) / 2, len = r - l;
		int leftNum = getLeftNum(l, r, d), rightNum = len - leftNum;
		if(x < sorted[mid]){
			int newl = max(L, L + getLeftNum(L, l, d));
			int newr = min(mid, newl + leftNum);
			return pos(newl, newr, x, L, mid, d + 1);
		}
		else{
			int newl = max(mid, mid + (l - L - getLeftNum(L, l, d)));
			int newr = min(R, newl + rightNum);
			return leftNum + pos(newl, newr, x, mid, R, d + 1);
		}
	}
} W;

template <class T>
pair<vector<T>, map<T, int>> compress(T* a, int n){
	vector<T> v;
	for(int i = 0; i < n; i++) v.push_back(a[i]);
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	map<T, int> m;
	for(int i = 0; i < v.size(); i++) m[v[i]] = i;
	for(int i = 0; i < n; i++) a[i] = m[a[i]];
	return { v, m };
}

struct P{
	ll x, y;
	bool operator < (const P& p) const{
		return x < p.x;
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N, M;
	cin >> N >> M;

	vector<ll> X(N), Y(N);
	vector<ll> X1(M), Y1(M), X2(M), Y2(M);
	vector<ll> xs;
	for(int i = 0; i < N; i++){
		cin >> X[i] >> Y[i];
		xs.push_back(X[i]);
	}
	for(int i = 0; i < M; i++){
		cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
		xs.push_back(X1[i]);
		xs.push_back(X2[i]);
	}
	auto xcomp = compress(xs.data(), xs.size());
	vector<P> ps(N);
	vector<ll> xx, yy;
	for(int i = 0; i < N; i++){
		X[i] = xcomp.second[X[i]];
		ps[i] = { X[i], Y[i] };
	}
	sort(ps.begin(), ps.end());
	for(int i = 0; i < N; i++){
		xx.push_back(ps[i].x);
		yy.push_back(ps[i].y);
	}
	for(int i = 0; i < M; i++){
		X1[i] = xcomp.second[X1[i]];
		X2[i] = xcomp.second[X2[i]];
	}

	W.init(yy);
	for(int i = 0; i <= 4; i++){
		//cout << W.pos(0, 3, i) << endl;
	}
	for(int i = 0; i < M; i++){
		int l = lower_bound(xx.begin(), xx.end(), X1[i]) - xx.begin();
		int r = upper_bound(xx.begin(), xx.end(), X2[i]) - xx.begin();

		cout << W.freq2(l, r, Y1[i], Y2[i]) << endl;
	}
}

Measured memory_bytes: 167808