#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-12;

//int N, M, K, T, H, W, L, R;
long long int N, M, K, T, H, W, L, R;



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

	cin >> N >> M;
	map<int, int>xp;
	map<int, int>yp;
	vector<int>x(N);
	vector<int>y(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i];
		xp[x[i]] = 0;
		yp[y[i]] = 0;
	}
	int cnt = 0;
	xp[MOD] = yp[MOD] = xp[-MOD] = yp[-MOD] = 0;
	for (auto &i : xp) {
		i.second = cnt++;
	}
	cnt = 0;
	for (auto &i : yp) {
		i.second = cnt++;
	}
	H = yp.size(), W = xp.size();
	vector<vector<int>>sum(H, vector<int>(W));
	for (int i = 0; i < N; i++) {
		sum[yp[y[i]]][xp[x[i]]]++;
	}
	for (int i = 0; i < H; i++) {
		for (int j = 1; j < W; j++) {
			sum[i][j] += sum[i][j - 1];
		}
	}
	for (int i = 1; i < H; i++) {
		for (int j = 0; j < W; j++) {
			sum[i][j] += sum[i - 1][j];
		}
	}
	//cout << H << " " << W << endl;
	while (M--) {
		cin >> L >> R;
		int sx = xp.lower_bound(L)->second;
		int sy = yp.lower_bound(R)->second;
		cin >> L >> R;
		int gx = xp.upper_bound(L)->second - 1;
		int gy = yp.upper_bound(R)->second - 1;
	//	cout << sy << " " << sx << " " << gy << " " << gx << endl;
		sy--, sx--;
		cout << sum[gy][gx] - sum[gy][sx] - sum[sy][gx] + sum[sy][sx] << endl;
	}
}
