#include <bits/stdc++.h>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;


const int nmax=5002;
int sum[nmax][nmax];

int x[nmax],y[nmax];
vi xx,yy;

int main(void){
	int n,m;
	scanf("%d %d",&n,&m);
	rep(i,n){
		scanf("%d %d",&x[i],&y[i]);
		xx.pb(x[i]);
		yy.pb(y[i]);
	}

	sort(xx.begin(),xx.end());
	xx.erase(unique(xx.begin(),xx.end()),xx.end());

	sort(yy.begin(),yy.end());
	yy.erase(unique(yy.begin(),yy.end()),yy.end());

	rep(i,n){
		int fx=lower_bound(all((xx)),x[i])-xx.begin();
		int fy=lower_bound(all((yy)),y[i])-yy.begin();
		sum[fx+1][fy+1]++;
	}

	rep(i,xx.size())rep(j,yy.size()) sum[i+1][j+1]=(sum[i+1][j+1]+sum[i+1][j]+sum[i][j+1]-sum[i][j]);

	rep(i,m){
		int x1,x2,y1,y2;
		scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
		int lx=lower_bound(all((xx)),x1)-xx.begin();
		int rx=lower_bound(all((xx)),x2+1)-xx.begin();
		int ly=lower_bound(all((yy)),y1)-yy.begin();
		int ry=lower_bound(all((yy)),y2+1)-yy.begin();
		printf("%d\n",sum[rx][ry]-sum[lx][ry]-sum[rx][ly]+sum[lx][ly]);
	}
	return 0;
}