#include<bits/stdc++.h>
#define mid ((l + r) >> 1)
using namespace std;
inline char gc(){
static char buf[10000005],*t1 = buf,*t2 = buf;
return t1 == t2 && (t2 = (t1 = buf) + fread(buf,1,1000000,stdin),t1 == t2) ? EOF : *t1++;
}
int read(){
char c = gc();
int x = 0;
while(c < '0' || c > '9')
c = gc();
while(c >= '0' && c <= '9'){
x = (x << 3) + (x << 1) + c - 48;
c = gc();
}
return x;
}
const int N = 5e5 + 9;
int n,m;
struct OPTION{
int x,y,id;
int pos,opt,val;
} OP[N << 5];
bool cmp_x(OPTION op1,OPTION op2){
return (op1.x ^ op2.x) ? (op1.x < op2.x) : ((op1.y ^ op2.y) ? op1.y < op2.y : ((op1.id ^ op2.id) ? op1.id < op2.id : op1.val > op2.val));
}
bool cmp_y(OPTION op1,OPTION op2){
return ((op1.y ^ op2.y) ? op1.y < op2.y : ((op1.id ^ op2.id) ? op1.id < op2.id : op1.val > op2.val));
}
int opt_cnt,query_cnt;
struct BinaryIndexedTree{
int t[N];
int lowbit(int x){
return x & (-x);
}
int query(int pos){
int ret = 0;
for(int i = pos;i;i -= lowbit(i))
ret += t[i];
return ret;
}
void update(int pos,int v){
for(int i = pos;i <= opt_cnt;i += lowbit(i))
t[i] += v;
}
BinaryIndexedTree(){
memset(t,0,sizeof t);
}
} BIT;
int ans[N];
void CDQ(int l,int r){
if(l >= r)
return;
CDQ(l,mid);CDQ(mid + 1,r);
int i = l,j = mid + 1;
sort(OP + l,OP + mid + 1,cmp_y);
sort(OP + mid + 1,OP + r + 1,cmp_y);
while(j <= r){
while(i <= mid && OP[i].y <= OP[j].y){
if(!OP[i].opt)
BIT.update(OP[i].id,OP[i].val);
i++;
}
if(OP[j].opt)
ans[OP[j].pos] += BIT.query(OP[j].id) * OP[j].opt;
j++;
}
for(int k = l;k < i;k++)
if(!OP[k].opt)
BIT.update(OP[k].id,-OP[k].val);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
n = read();m = read();
for(int i = 1;i <= n;i++)
OP[++opt_cnt] = (OPTION){read(),read(),i,0,0,1};
for(int i = 1;i <= m;i++){
int x1 = read(),y1 = read(),x2 = read(),y2 = read();
query_cnt++;
OP[++opt_cnt] = (OPTION){x2,y2,n + i,query_cnt,1,0};
OP[++opt_cnt] = (OPTION){x1 - 1,y2,n + i,query_cnt,-1,0};
OP[++opt_cnt] = (OPTION){x2,y1 - 1,n + i,query_cnt,-1,0};
OP[++opt_cnt] = (OPTION){x1 - 1,y1 - 1,n + i,query_cnt,1,0};
}
sort(OP + 1,OP + opt_cnt + 1,cmp_x);
CDQ(1,opt_cnt);
for(int i = 1;i <= query_cnt;i++)
cout << ans[i] << '\n';
return 0;
}