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

public class stars_mb {
    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 abstract class Event implements Comparable<Event> {
        final int y;

        public Event(int y) {
            this.y = y;
        }

        public final int compareTo(Event e) {
            return y - e.y;
        }

        public abstract int index();
        public abstract int action(SegTree tree);
    }

    static class PointEvent extends Event {
        final int x;

        public PointEvent(int x, int y) {
            super(y);
            this.x = x;
        }

        public int action(SegTree tree) {
            tree.increment(x);
            return -1;
        }

        public int index() {
            return -1;
        }

        public int hashCode() {
            return x * 31 + y;
        }

        public boolean equals(Object o) {
            if (o instanceof PointEvent) {
                PointEvent that = (PointEvent) o;
                return x == that.x && y == that.y;
            } else {
                return false;
            }
        }
    }

    static class QueryEvent extends Event {
        final int minX, maxX, index, multiple;

        public QueryEvent(int minX, int maxX, int minY, int maxY, int index, int multiple) {
            super(multiple < 0 ? minY : maxY);
            this.minX = minX;
            this.maxX = maxX;
            this.index = index;
            this.multiple = multiple;
        }

        public int index() {
            return index;
        }

        public int action(SegTree tree) {
            return multiple * tree.sum(minX, maxX);
        }
    }

    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;

        {
            Map<Integer, Integer> usedX = new TreeMap<Integer, Integer>();
            for (int i = 0; i < n; ++i) {
                usedX.put(px[i], 0);
            }
            for (int i = 0; i < m; ++i) {
                usedX.put(qMinX[i], 0);
                usedX.put(qMaxX[i], 0);
            }
            int count = 0;
            for (Map.Entry<Integer, Integer> e : usedX.entrySet()) {
                e.setValue(count++);
            }
            for (int i = 0; i < n; ++i) {
                px[i] = usedX.get(px[i]);
            }
            for (int i = 0; i < m; ++i) {
                qMinX[i] = usedX.get(qMinX[i]);
                qMaxX[i] = usedX.get(qMaxX[i]);
            }

            countXs = usedX.size();
        }

        Set<PointEvent> pointEvents = new HashSet<PointEvent>();
        Event[] events = new Event[n + 2 * m];
        for (int i = 0, j = 0; i < m; ++i, ++j) {
            events[j] = new QueryEvent(qMinX[i], qMaxX[i], qMinY[i], qMaxY[i], i, -1);
        }
        for (int i = 0, j = m; i < n; ++i, ++j) {
            PointEvent event = new PointEvent(px[i], py[i]);
            events[j] = event;
            pointEvents.add(event);
        }
        for (int i = 0, j = m + n; i < m; ++i, ++j) {
            events[j] = new QueryEvent(qMinX[i], qMaxX[i], qMinY[i], qMaxY[i], i, 1);
        }

        //The sorting algorithm is stable, so the lower-bound events will be processed before any point of the same ordinate, 
        //and the upper-bound events will be processed after them.
        Arrays.sort(events);

        SegTree segTree = new SegTree(countXs);
        for (Event e : events) {
            int a = e.action(segTree);
            int i = e.index();
            if (i >= 0) {
                qRes[i] += a;
            }
        }

        a$$ert("coinciding points found", pointEvents.size() == n);

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