#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)


int main(){
	int n,m;
	cin>>n>>m;
	
	set<int> posx;
	
	vector<pii> v(n);
	rep(i,n){
		int x,y;
		cin>>x>>y;
		v[i] = pii(x,y);
		posx.insert(x);
	}
	
	map<int,int> zip,unzip;
	
	int c=0;
	for(auto &e:posx){
		zip[e] = c;
		unzip[c] = e;
		c++;
	}
	
	vector<vector<int>> r(posx.size());
	
	rep(i,v.size()){
		r[zip[v[i].first]].pb(v[i].second);
	}
	
	rep(i,r.size()-1){
		rep(j,r[i].size()){
			r[i+1].pb(r[i][j]);
		}
	}
	rep(i,r.size())sort(all(r[i]));
	
	
	rep(i,m){
		int x1,y1,x2,y2;
		cin>>x1>>y1>>x2>>y2;
		
		auto left = posx.lower_bound(x1);
		auto right = posx.upper_bound(x2);
		
		int sub=0,add=0;
		
		if(left==posx.begin())sub=0;
		else{
			left--;
			vector<int> &t = r[zip[*left]];
			
			sub = (lower_bound(all(t),y1)-t.begin()) - (upper_bound(all(t),y2)-t.begin());
		}
		
		if(right==posx.begin())add=0;
		else{
			right--;
			vector<int> &t = r[zip[*right]];
			add = (lower_bound(all(t),y1)-t.begin()) - (upper_bound(all(t),y2)-t.begin());
		}
		cout<<sub-add<<endl;
	}
}