### main

n, k = gets.strip.split(' ').map{|s| s.to_i}

xhash = {}
yhash = {}
zhash = {}
cbs = []

n.times do
  x0, y0, z0, x1, y1, z1 = gets.strip.split(' ').map{|s| s.to_i}
  cbs << [x0, y0, z0, x1, y1, z1]
  xhash[x0] = xhash[x1] = yhash[y0] = yhash[y1] = zhash[z0] = zhash[z1] = 0
end

xs = xhash.keys.sort
ys = yhash.keys.sort
zs = zhash.keys.sort
nxs = xs.length - 1
nys = ys.length - 1
nzs = zs.length - 1
#p [xs, ys, zs]

xs.each_with_index{|x, i| xhash[x] = i}
ys.each_with_index{|y, i| yhash[y] = i}
zs.each_with_index{|z, i| zhash[z] = i}
#p [xhash, yhash, zhash]

ovls = nxs.times.map{nys.times.map{nzs.times.map{0}}}

for cb in cbs
  x0, y0, z0, x1, y1, z1 = cb
  for xi in (xhash[x0]...xhash[x1])
    for yi in (yhash[y0]...yhash[y1])
      for zi in (zhash[z0]...zhash[z1])
        ovls[xi][yi][zi] += 1
      end
    end
  end
end

vsum = 0

for xi in (0...nxs)
  dx = xs[xi + 1] - xs[xi]
  for yi in (0...nys)
    dy = ys[yi + 1] - ys[yi]
    for zi in (0...nzs)
      dz = zs[zi + 1] - zs[zi]
      if ovls[xi][yi][zi] >= k
        vsum += dx * dy * dz
      end
    end
  end
end

puts vsum