require 'set'

class Cuboid
	attr_reader *%w(x1 y1 z1 x2 y2 z2)
	def initialize(*args)
		@x1, @y1, @z1, @x2, @y2, @z2 = args
	end
end
		
n, k = gets.split.map &:to_i

z_events = []
n.times {
	c = Cuboid.new(*gets.split.map(&:to_i))
	z_events << [:add, c, c.z1]
	z_events << [:del, c, c.z2]
}
z_events.sort_by!(&:last)

volume = 0
z = 0
area = 0
z_cuboids = Set.new
until z_events.empty?
	next_z = z_events[0][2]
	volume += area * (next_z - z)
	while !z_events.empty? && z_events[0][2] == next_z
		command, c, _ = z_events.shift
		command == :add ? z_cuboids << c : z_cuboids.delete(c)
	end
		
	y_events = []
	z_cuboids.each {|c|
		y_events << [:add, c, c.y1]
		y_events << [:del, c, c.y2]
	}
	y_events.sort_by!(&:last)
	area = 0
	length = 0
	y = 0
	y_cuboids = Set.new
	until y_events.empty?
		next_y = y_events[0][2]
		area += length * (next_y - y)
		while !y_events.empty? && y_events[0][2] == next_y
			command, c, _ = y_events.shift
			command == :add ? y_cuboids << c : y_cuboids.delete(c)
		end

		x_events = []
		y_cuboids.each {|c|
			x_events << [:add, c, c.x1]
			x_events << [:del, c, c.x2]
		}
		x_events.sort_by!(&:last)
		length = 0
		x = 0
		overlap = 0
		until x_events.empty?
			next_x = x_events[0][2]
			length += next_x - x if overlap >= k

			while !x_events.empty? && x_events[0][2] == next_x
				command, c, _ = x_events.shift
				overlap += (command == :add ? 1 : -1)
			end
			x = next_x
		end

		y = next_y
	end
	z = next_z
end

p volume