#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n,m;
int ix[5000],iy[5000];
int sum[5005][5005];
int main()
{
	cin>>n>>m;
	vector<int>x,y;
	for(int i=0;i<n;i++)
	{
		cin>>ix[i]>>iy[i];
		x.push_back(ix[i]);
		y.push_back(iy[i]);
	}
	sort(x.begin(),x.end());x.erase(unique(x.begin(),x.end()),x.end());
	sort(y.begin(),y.end());y.erase(unique(y.begin(),y.end()),y.end());
	for(int i=0;i<n;i++)
	{
		int X=lower_bound(x.begin(),x.end(),ix[i])-x.begin();
		int Y=lower_bound(y.begin(),y.end(),iy[i])-y.begin();
		sum[X+1][Y+1]++;
	}
	for(int i=0;i<=x.size();i++)
	{
		for(int j=0;j<y.size();j++)sum[i][j+1]+=sum[i][j];
	}
	for(int j=0;j<=y.size();j++)
	{
		for(int i=0;i<x.size();i++)sum[i+1][j]+=sum[i][j];
	}
	for(int i=0;i<m;i++)
	{
		int xl,yl,xr,yr;
		cin>>xl>>yl>>xr>>yr;
		xl=lower_bound(x.begin(),x.end(),xl)-x.begin();
		yl=lower_bound(y.begin(),y.end(),yl)-y.begin();
		xr=upper_bound(x.begin(),x.end(),xr)-x.begin();
		yr=upper_bound(y.begin(),y.end(),yr)-y.begin();
		cout<<sum[xr][yr]-sum[xr][yl]-sum[xl][yr]+sum[xl][yl]<<endl;
	}
}

