
#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>
using namespace std;

int main()
{
  int n,m;
  int x1,y1,x2,y2;
  vector<int> x,y;
  vector<int> ix,iy;
  vector< vector<int> > dp;

  cin>>n>>m;
  x.resize(n);
  y.resize(n);
  for(int i=0; i<n; i++){
    cin>>x[i]>>y[i];
    ix.push_back(x[i]);
    iy.push_back(y[i]);
  }
  ix.push_back(INT_MIN);
  iy.push_back(INT_MIN);
  sort(ix.begin(), ix.end());
  sort(iy.begin(), iy.end());
  ix.erase(unique(ix.begin(), ix.end()), ix.end());
  iy.erase(unique(iy.begin(), iy.end()), iy.end());

  dp.resize(iy.size(), vector<int>(ix.size(), 0));
  for(int i=0; i<n; i++){
    int ty = lower_bound(iy.begin(), iy.end(), y[i]) - iy.begin();
    int tx = lower_bound(ix.begin(), ix.end(), x[i]) - ix.begin();
    dp[ty][tx]++;
  }
  for(int i=1; i<iy.size(); i++){
    for(int j=1; j<ix.size(); j++){
      dp[i][j] += dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1];
    }
  }

  for(int i=0; i<m; i++){
    cin>>x1>>y1>>x2>>y2;
    int ix1,iy1,ix2,iy2;
    iy1 = lower_bound(iy.begin(), iy.end(), y1) - iy.begin();
    ix1 = lower_bound(ix.begin(), ix.end(), x1) - ix.begin();
    iy2 = upper_bound(iy.begin(), iy.end(), y2) - iy.begin()-1;
    ix2 = upper_bound(ix.begin(), ix.end(), x2) - ix.begin()-1;
    cout<<dp[iy2][ix2]+dp[iy1-1][ix1-1]-dp[iy1-1][ix2]-dp[iy2][ix1-1]<<endl;
  }
}