#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <map>
#include <cstdio>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  set<int> X_, Y_;
  vector< pair<int,int> > x_y(n);
  int x, y;
  for(int i = 0; i < n; ++i){
    cin >> x >> y;
    X_.insert(x);
    Y_.insert(y);
    x_y[i] = make_pair(x,y);
  }
  vector<int> X, Y;
  for(set<int>::iterator itr = X_.begin(); itr != X_.end(); ++itr)
    X.push_back(*itr);
  for(set<int>::iterator itr = Y_.begin(); itr != Y_.end(); ++itr)
    Y.push_back(*itr);

  map<int,int> M_x, M_y;
  for(int i = 0; i < X.size(); ++i) M_x[X[i]] = i;
  for(int i = 0; i < Y.size(); ++i) M_y[Y[i]] = i;
  int h = X.size(), w = Y.size();
  vector< vector<int> >  acum(h+2,vector<int>(w+2,0));
  for(int i = 0; i < n; ++i){
    int x = x_y[i].first, y = x_y[i].second;
    ++acum[M_x[x]+1][M_y[y]+1];
  }
  
  
  for(int i = 1; i <= h+1; ++i){
    for(int j = 1; j <= w+1; ++j){
      acum[i][j] += acum[i][j-1];
    }
    for(int j = 1; j <= w+1; ++j){
      acum[i][j] += acum[i-1][j];
    }
  }
  int x_1, x_2, y_1, y_2;
  for(int i = 0; i < m; ++i){
    cin >> x_1 >> y_1 >> x_2 >> y_2;
    int x_1_ = lower_bound(X.begin(),X.end(),x_1)-X.begin(),
      y_1_ = lower_bound(Y.begin(),Y.end(),y_1)-Y.begin(),
      x_2_ = upper_bound(X.begin(),X.end(),x_2)-X.begin(),
      y_2_ = upper_bound(Y.begin(),Y.end(),y_2)-Y.begin();
    cout << acum[x_2_][y_2_] - acum[x_2_][y_1_] - acum[x_1_][y_2_] + acum[x_1_][y_1_] << endl;
  }
  return 0;
}

