#include<cstdio>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;

#define fs first
#define sc second
#define MAX 1000000001
#define a(x) (x).begin(),(x).end()
#define pb push_back

int n,m;
int sum[5100][5100];
pair<int,int> p[5100];
vector<int> x,y;
int x1,y1,x2,y2;

int main(){
  scanf("%d%d",&n,&m);
  x.resize(n+2); y.resize(n+2);
  for(int i=0;i<n;i++){
    scanf("%d%d",&x[i],&y[i]);
    p[i].fs = x[i]; p[i].sc = y[i];
  }

  x[n] = MAX; x[n+1] = -MAX; 
  y[n] = MAX; y[n+1] = -MAX;
  sort(a(x)); sort(a(y));
  x.erase(unique(a(x)),x.end()); y.erase(unique(a(y)),y.end());

  for(int i=0;i<n;i++){
    p[i].fs = lower_bound(a(x),p[i].fs) - x.begin();
    p[i].sc = lower_bound(a(y),p[i].sc) - y.begin();
  }
  sort(p,p+n);

  int cnt = 0;
  for(int i=0;i<x.size();i++)
    for(int j=0;j<y.size();j++){
      if(!i || !j)sum[i][j] = 0;
      else sum[i][j] = sum[i][j-1] + sum[i-1][j] - sum[i-1][j-1];
      while(cnt<n && p[cnt].fs == i && p[cnt].sc == j){
	sum[i][j]++; cnt++;
      }
    }

  for(int i=0;i<m;i++){
    scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
    x1 = lower_bound(a(x),x1)-x.begin()-1;
    y1 = lower_bound(a(y),y1)-y.begin()-1;
    x2 = upper_bound(a(x),x2)-x.begin()-1;
    y2 = upper_bound(a(y),y2)-y.begin()-1;
    printf("%d\n",sum[x2][y2] - sum[x2][y1] - sum[x1][y2] + sum[x1][y1]);
  }
}