import java.io.*;
import java.util.*;

public class stars_sk implements Runnable {
	public static void main(String[] args) {
		Locale.setDefault(Locale.US);
		new Thread(new stars_sk()).start();
	}
	
	StringTokenizer st;
	BufferedReader in;
	PrintWriter out;
	final String FILE = "stars";
	
	String nextToken() throws IOException {
		while ((st == null) || (!st.hasMoreTokens())) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}
	
	public void run() {
		try {
			in = new BufferedReader(new FileReader(FILE + ".in"));
			out = new PrintWriter(FILE + ".out");
			solution();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
	
	int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}
	
	void inc(int i) {
		i += tb;
		t[i]++;
		while (i != 0) {
			i = (i - 1) / 2;
			t[i] = t[2 * i + 1] + t[2 * i + 2];
		}
	}
	
	int get(int a, int b) {
		a += tb;
		b += tb;
		int ans = 0;
		while (a != b) {
			if (a % 2 == 0) {
				ans += t[a];
				a++;
			}
			if (b % 2 == 0) {
				b--;
				ans += t[b];
			}
			a = (a - 1) / 2;
			b = (b - 1) / 2;
		}
		
		return ans;
	}
	
	class P implements Comparable<P> {
		int x, y;
		boolean real;
	
		public P(int x, int y, boolean r) {
			this.x = x;
			this.y = y;
			sy.add(y);
			real = r;
		}
		
		@Override
		public int compareTo(P o) {
			if (x != o.x) {
				return x - o.x;
			}
			return y - o.y;
		}
	}
	
	class Q {
		P[] pp, pm;
		
		public Q(int x1, int x2, int y1, int y2) {
			pp = new P[]{new P(x2, y2, false), new P(x1 - 1, y1 - 1, false)};
			pm = new P[]{new P(x1 - 1, y2, false), new P(x2, y1 - 1, false)};
		}
		
		void add() {
			s.add(pp[0]);
			s.add(pp[1]);
			s.add(pm[0]);
			s.add(pm[1]);
		}
		
		int get() {
			return mv.get(pp[0]) + mv.get(pp[1]) - mv.get(pm[0]) - mv.get(pm[1]);
		}
	}
	
	int[] t;
	int tb;
	
	int n, m;
	Q[] q;
	P[] p;
	
	Integer[] y;
	
	Map<P, Integer> mv = new TreeMap<P, Integer>();
	TreeSet<P> s = new TreeSet<P>();
	TreeSet<Integer> sy = new TreeSet<Integer>();
	Map<Integer, Integer> ytn = new HashMap<Integer, Integer>();
	
	void solution() throws Exception {
		// input
		n = nextInt();
		m = nextInt();
	
		p = new P[n];
		for (int i = 0; i < n; i++) {
			p[i] = new P(nextInt(), nextInt(), true);
		}
		
		q = new Q[m];
		for (int i = 0; i < m; i++) {
			q[i] = new Q(nextInt(), nextInt(), nextInt(), nextInt());
		}

		
		// prepare
		y = sy.toArray(new Integer[]{});
		for (int i = 0; i < y.length; i++) {
			ytn.put(y[i], i);
		}
		for (P np : p) {
			np.y = ytn.get(np.y);
			s.add(np);
		}
		for (Q nq : q) {
			for (P np : nq.pm) {
				np.y = ytn.get(np.y);
			}
			for (P np : nq.pp) {
				np.y = ytn.get(np.y);
			}
			nq.add();
		}
		
		tb = 1;
		while (tb < y.length) {
			tb *= 2;
		}
		t = new int[2 * tb - 1];
		tb--;
		
		
		// calc
		for (P np : s) {
			if (np.real) {
				inc(np.y);
			}
			
			int c = get(0, np.y + 1);
			mv.put(np, c);
		}
		
		
		// output
		for (Q nq : q) {
			out.println(nq.get());
		}
	}
}