#include<string>
#include<vector>
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define INF 1000000001


int s[5010][5010];

int main(){

	int n,m,x1,y1,x2,y2,x3,y3;
	vector<int>x,y,X,Y;

	cin >> n >> m;

	rep(i,n){

	cin >> x1 >> y1;

	x.push_back(x1);
	y.push_back(y1);

	}

	X=x; Y=y;

	x.push_back(-INF); x.push_back(INF);
	y.push_back(-INF); y.push_back(INF);

	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,n){

	int dx=lower_bound(x.begin(),x.end(),X[i])-x.begin();
	int dy=lower_bound(y.begin(),y.end(),Y[i])-y.begin();

	s[dy][dx]++;

	}

	REP(i,1,n) REP(j,1,n) s[i][j]+=s[i][j-1]+s[i-1][j]-s[i-1][j-1];


	rep(i,m){

	cin >> x2 >> y2 >> x3 >> y3;

	int dx2=lower_bound(x.begin(),x.end(),x2)-x.begin();
	int dy2=lower_bound(y.begin(),y.end(),y2)-y.begin();
	int dx3=upper_bound(x.begin(),x.end(),x3)-x.begin()-1;
	int dy3=upper_bound(y.begin(),y.end(),y3)-y.begin()-1;


    cout << s[dy3][dx3]-s[dy2-1][dx3]-s[dy3][dx2-1]+s[dy2-1][dx2-1] << endl;


	}

	return 0;
}