n, k = gets.split.map(&:to_i)
x = {}
y = {}
z = {}
xs = []
ys = []
zs = []
areas = []
n.times do
  area = gets.split.map(&:to_i)
  areas << area
  xs << area[0]; xs << area[3]
  ys << area[1]; ys << area[4]
  zs << area[2]; zs << area[5]
end
xs.sort!
ys.sort!
zs.sort!
xss = xs.size
yss = ys.size
zss = zs.size
xs.each_with_index{ |a, i| x[a] = i }
ys.each_with_index{ |b, i| y[b] = i }
zs.each_with_index{ |c, i| z[c] = i }
sea = Array.new(xss){ Array.new(yss){ Array.new(zss, 0) }}
for area in areas
  x0, y0, z0, x1, y1, z1 = area
  for a in (x[x0]...x[x1])
    for b in (y[y0]...y[y1])
      for c in (z[z0]...z[z1])
        sea[a][b][c] += 1
      end
    end
  end
end

ret = 0
for a in (0...xss-1)
  dx = xs[a+1] - xs[a]
  for b in (0...yss-1)
    dy = ys[b+1] - ys[b]
    for c in (0...zss-1)
      dz = zs[c+1] - zs[c]
      if sea[a][b][c] >= k
        ret += dx * dy * dz
      end
    end
  end
end
p ret