def compress(used_x)
	x_map = {}
	used_x.to_a.sort.each_with_index{|x, i| x_map[x] = i}
	x_map
end

class Array
	def accum
		inject([0]){|a, x| a + [a[-1] + x]}
	end

	def accum!
		(1..size-1).each{|i|
			self[i] += self[i-1]
		}
		self.unshift(0)
	end

	def accum_2d
		ac = map{|r| r.accum}
		(1..size-1).each{|i|
			(1..ac[0].size-1).each{|j|
				ac[i][j] += ac[i-1][j]
			}
		}
		ac.unshift([0] * ac[0].size)
		ac
	end

	def accum_2d!
		each{|r| r.accum!}
		(1..size-1).each{|i|
			(1..self[0].size-1).each{|j|
				self[i][j] += self[i-1][j]
			}
		}
		unshift([0] * self[0].size)
	end
		
	def bsearch_first_index(l = 0, r = size - 1, &pred)
		return nil if l > r
		c = (l + r) / 2 
		if pred[self[c]]
			bsearch_first_index(l, c-1, &pred) || c
		else
			bsearch_first_index(c+1, r, &pred)
		end
	end

	def bsearch_first_item(l = 0, r = size - 1, &pred)
		i = bsearch_first_index(l, r, &pred)
		i ? self[i] : nil
	end

	def bsearch_last_index(l = 0, r = size - 1, &pred)
		return nil if l > r
		c = (l + r) / 2 
		if pred[self[c]]
			bsearch_last_index(c+1, r, &pred) || c
		else
			bsearch_last_index(l, c-1, &pred)
		end
	end

	def bsearch_last_item(l = 0, r = size - 1, &pred)
		i = bsearch_last_index(l, r, &pred)
		i ? self[i] : nil
	end
end

require 'set'

n, m = gets.split.map &:to_i
used_x = Set.new
used_y = Set.new

treasure = (1..n).map{
	x, y = gets.split.map &:to_i
	used_x << x
	used_y << y
	[x, y]
}

x_map = compress(used_x)
y_map = compress(used_y)
a = (0..x_map.size-1).map { [0] * y_map.size }
treasure.each{|x, y|
	a[x_map[x]][y_map[y]] += 1
}

a.accum_2d!

used_x = used_x.to_a.sort
used_y = used_y.to_a.sort

queries = (1..m).map {
	gets.split.map &:to_i
}

queries.each{|x1, y1, x2, y2|
	i1 = used_x.bsearch_first_index{|x| x1 <= x}
	if !i1
		puts 0
		break
	end
	j1 = used_y.bsearch_first_index{|y| y1 <= y}
	if !j1
		puts 0
		break
	end
	i2 = used_x.bsearch_last_index(i1, used_x.size-1){|x| x <= x2}
	if !i2
		puts 0
		break
	end
	j2 = used_y.bsearch_last_index(j1, used_y.size-1){|y| y <= y2}
	if !j2
		puts 0
		break
	end

	a[i2+1][j2+1] - a[i2+1][j1] - a[i1][j2+1] + a[i1][j1]
}