#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e12;

bool lessY(const mp &a, const mp &b){
 return a.second != b.second ? a.second < b.second : a.first < b.first;
}

int main(){
 ll n,m;
 cin>>n>>m;
 vector<ll> x(n),y(n);
 vector<mp> z(n);
 for(ll i=0;i<n;i++) cin>>x[i]>>y[i];
 for(ll i=0;i<n;i++) z[i] = mp(x[i],y[i]);
 set<ll> ux,uy;// unique x,y;
 for(auto i:x) ux.insert(i);
 for(auto i:y) uy.insert(i);
 ll h = ux.size(),w = uy.size();
 vector<ll> rx,ry;
 for(auto i:ux) rx.push_back(i);
 for(auto i:uy) ry.push_back(i);
 vector<vector<ll> > dp(h+1,vector<ll>(w+1,0) );
 for(int i=0;i<n;i++){
  auto ix = lower_bound(rx.begin(),rx.end() , x[i] );
  auto iy = lower_bound(ry.begin(),ry.end() , y[i] );
  int xi = ix-rx.begin();
  int yi = iy-ry.begin();
 // cout<<xi<<' '<<yi<<endl;
  dp[xi+1][yi+1]++;
 }
 for(int i=0;i<h;i++)
  for(int j=0;j<w;j++) dp[i+1][j+1] += dp[i+1][j]+dp[i][j+1]-dp[i][j];

 for(ll i=0;i<m;i++){
  ll sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  auto xs = lower_bound(rx.begin(),rx.end(), sx );
  auto ys = lower_bound(ry.begin(),ry.end(), sy );
  auto xt = upper_bound(rx.begin(),rx.end(), tx );
  auto yt = upper_bound(ry.begin(),ry.end(), ty );
  //xt--,yt--;
  int ssx = xs-rx.begin();
  int ssy = ys-ry.begin();
  int ttx = xt-rx.begin();
  int tty = yt-ry.begin();
  //cout<<ssx<<' '<<ssy<<' '<<ttx<<' '<<tty<<endl;
  cout<<dp[ttx][tty]-dp[ttx][ssy]-dp[ssx][tty]+dp[ssx][ssy]<<endl;
 }


}

