#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

const pii Dir[8] = { //?????????
	{ 0,1 },{ 0,-1 },{ 1,0 },{ -1,0 },
	{ 1,1 },{ 1,-1 },{ -1,-1 },{ -1,1 }
};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}

signed main() {
	int n, m;
	scanf("%d %d", &n, &m);
	vector<pii> px(n);
	vector<pii> py(n);
	vector<int> pxynum(n);
	REP(i, n) {
		scanf("%d %d", &px[i].first, &px[i].second);
		py[i] = { px[i].second,px[i].first };
	}
	sort(ALL(px));
	sort(ALL(py));
	int cou = 0;
	for (auto cur : px) {
		auto itr = lower_bound(ALL(py), make_pair( cur.second,cur.first ));
		pxynum[cou] = itr - py.begin();
		cou++;
	}

	REP(i, m) {
		int a, b, c, d;
		scanf("%d %d %d %d", &a, &b, &c, &d);

		auto s = lower_bound(ALL(px), make_pair( a,-INT_MAX ));
		auto f = upper_bound(s,px.end(), make_pair(c, INT_MAX));
		int ys = lower_bound(ALL(py), make_pair(b, -INT_MAX))-py.begin();
		int yf = upper_bound(py.begin()+ys,py.end(), make_pair(d, INT_MAX))-py.begin();
		int ans = 0;
		for (int i = s-px.begin(); i < f-px.begin(); i++) {
			if (RANGE(pxynum[i], ys, yf - 1)) {
				ans++;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}