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

public class stars_mb_fast {
    static void a$$ert(String msg, boolean exp) {
        if (!exp) {
            throw new AssertionError(msg);
        }
    }

    static class SegTree {
        int[] data;
        int offset;

        SegTree(int size) {
            offset = 1;
            while (offset < size) {
                offset += offset;
            }
            data = new int[offset + offset];
        }

        void increment(int index) {
            index += offset;
            while (index > 0) {
                ++data[index];
                index >>>= 1;
            }
        }

        int sum(int lhs, int rhs) {
            lhs += offset;
            rhs += offset;
            int result = 0;
            while (lhs <= rhs) {
                if ((lhs & 1) == 1) {
                    result += data[lhs];
                }
                if ((rhs & 1) == 0) {
                    result += data[rhs];
                }
                lhs = (lhs + 1) >>> 1;
                rhs = (rhs - 1) >>> 1;
            }
            return result;
        }
    }

    static class Reindexer {
        int[] input;
        int[] output;
        int size;

        public Reindexer(int maxSize) {
            input = new int[maxSize];
        }
        public void add(int value) {
            input[size++] = value;
        }
        public void prepare() {
            //Try to comment out
            Arrays.sort(input, 0, size);
            int uniqueCount = 1;
            for (int i = 1; i < size; ++i) {
                if (input[i] != input[i - 1]) {
                    ++uniqueCount;
                }
            }
            output = new int[uniqueCount];
            output[0] = input[0];
            for (int i = 1, j = 1; i < size; ++i) {
                if (input[i] != input[i - 1]) {
                    output[j++] = input[i];
                }
            }
        }

        public int outputSize() {
            return output.length;
        }
        public int get(int index) {
            int left = 0, right = output.length;
            while (right - left > 1) {
                int mid = (left + right) >>> 1;
                if (output[mid] <= index) {
                    left = mid;
                } else {
                    right = mid;
                }
            }
            return left;
        }
    }

    static class IntScanner implements Closeable {
        BufferedReader in;
        StringTokenizer st;

        public IntScanner(String fileName) throws IOException {
            in = new BufferedReader(new FileReader(fileName));
        }

        public int nextInt() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(in.readLine());
            }
            return Integer.parseInt(st.nextToken());
        }

        public void close() throws IOException {
            in.close();
        }
    }

    static final int MAX_C = 1000000000;

    public static void main(String[] args) throws IOException {
        IntScanner in = new IntScanner("stars.in");
        int n = in.nextInt();
        int m = in.nextInt();

        a$$ert("n is out of bounds", 1 <= n && n <= 100000);
        a$$ert("m is out of bounds", 1 <= m && m <= 50000);

        int[] px = new int[n];
        int[] py = new int[n];
        int[] qMinX = new int[m];
        int[] qMinY = new int[m];
        int[] qMaxX = new int[m];
        int[] qMaxY = new int[m];
        int[] qRes = new int[m];

        for (int i = 0; i < n; ++i) {
            px[i] = in.nextInt();
            py[i] = in.nextInt();

            a$$ert("Point X is out of bounds", -MAX_C <= px[i] && px[i] <= MAX_C);
            a$$ert("Point Y is out of bounds", -MAX_C <= py[i] && py[i] <= MAX_C);
        }
        for (int i = 0; i < m; ++i) {
            qMinX[i] = in.nextInt();
            qMaxX[i] = in.nextInt();
            qMinY[i] = in.nextInt();
            qMaxY[i] = in.nextInt();

            a$$ert("Query X is out of bounds", -MAX_C <= qMinX[i] && qMinX[i] <= MAX_C);
            a$$ert("Query Y is out of bounds", -MAX_C <= qMinY[i] && qMinY[i] <= MAX_C);
            a$$ert("Query X is out of bounds", -MAX_C <= qMaxX[i] && qMaxX[i] <= MAX_C);
            a$$ert("Query Y is out of bounds", -MAX_C <= qMaxY[i] && qMaxY[i] <= MAX_C);
            a$$ert("minX > maxX", qMinX[i] <= qMaxX[i]);
            a$$ert("minY > maxY", qMinY[i] <= qMaxY[i]);
        }
        in.close();

        int countXs, countYs;
        {
            Reindexer rX = new Reindexer(n + 2 * m);
            Reindexer rY = new Reindexer(n + 2 * m);
            for (int i = 0; i < n; ++i) {
                rX.add(px[i]);
                rY.add(py[i]);
            }
            for (int i = 0; i < m; ++i) {
                rX.add(qMinX[i]);
                rX.add(qMaxX[i]);
                rY.add(qMinY[i]);
                rY.add(qMaxY[i]);
            }
            rX.prepare();
            rY.prepare();
            countXs = rX.outputSize();
            countYs = rY.outputSize();
            for (int i = 0; i < n; ++i) {
                px[i] = rX.get(px[i]);
                py[i] = rY.get(py[i]);
            }
            for (int i = 0; i < m; ++i) {
                qMinX[i] = rX.get(qMinX[i]);
                qMaxX[i] = rX.get(qMaxX[i]);
                qMinY[i] = rY.get(qMinY[i]);
                qMaxY[i] = rY.get(qMaxY[i]);
            }
        }

        int[] removeEventCount = new int[countYs];
        int[][] removeEventsMin = new int[countYs][];
        int[][] removeEventsMax = new int[countYs][];
        int[][] removeEventsIdx = new int[countYs][];
        int[] addEventCount = new int[countYs];
        int[][] addEventsMin = new int[countYs][];
        int[][] addEventsMax = new int[countYs][];
        int[][] addEventsIdx = new int[countYs][];
        int[] starEventCount = new int[countYs];
        int[][] starEvents = new int[countYs][];

        //Adding stars
        for (int i = 0; i < n; ++i) {
            ++starEventCount[py[i]];
        }
        for (int i = 0; i < countYs; ++i) {
            starEvents[i] = new int[starEventCount[i]];
            starEventCount[i] = 0;
        }
        for (int i = 0; i < n; ++i) {
            starEvents[py[i]][starEventCount[py[i]]++] = px[i];
        }

        //Adding remove and add events
        for (int i = 0; i < m; ++i) {
            ++removeEventCount[qMinY[i]];
            ++addEventCount[qMaxY[i]];
        }
        for (int i = 0; i < countYs; ++i) {
            removeEventsMin[i] = new int[removeEventCount[i]];
            removeEventsMax[i] = new int[removeEventCount[i]];
            removeEventsIdx[i] = new int[removeEventCount[i]];
            addEventsMin[i] = new int[addEventCount[i]];
            addEventsMax[i] = new int[addEventCount[i]];
            addEventsIdx[i] = new int[addEventCount[i]];
            removeEventCount[i] = 0;
            addEventCount[i] = 0;
        }
        for (int i = 0; i < m; ++i) {
            int minY = qMinY[i];
            int maxY = qMaxY[i];
            removeEventsMin[minY][removeEventCount[minY]] = qMinX[i];
            removeEventsMax[minY][removeEventCount[minY]] = qMaxX[i];
            removeEventsIdx[minY][removeEventCount[minY]++] = i;
            addEventsMin[maxY][addEventCount[maxY]] = qMinX[i];
            addEventsMax[maxY][addEventCount[maxY]] = qMaxX[i];
            addEventsIdx[maxY][addEventCount[maxY]++] = i;
        }

        //Processing events.
        SegTree segTree = new SegTree(countXs);
        for (int y = 0; y < countYs; ++y) {
            int[] rEMin = removeEventsMin[y];
            int[] rEMax = removeEventsMax[y];
            int[] rEIdx = removeEventsIdx[y];
            int[] aEMin = addEventsMin[y];
            int[] aEMax = addEventsMax[y];
            int[] aEIdx = addEventsIdx[y];
            int[] sE = starEvents[y];
            for (int e = 0, lim = removeEventCount[y]; e < lim; ++e) {
                qRes[rEIdx[e]] -= segTree.sum(rEMin[e], rEMax[e]);
            }
            for (int e = 0, lim = starEventCount[y]; e < lim; ++e) {
                segTree.increment(sE[e]);
            }
            for (int e = 0, lim = addEventCount[y]; e < lim; ++e) {
                qRes[aEIdx[e]] += segTree.sum(aEMin[e], aEMax[e]);
            }
        }

        PrintWriter out = new PrintWriter("stars.out");
        for (int i : qRes) {
            out.println(i);
        }
        out.close();
    }
}
