fun main(args: Array<String>?): Unit {
    fun <T> List<T>.doubling(): List<T> = flatMap{listOf(it, it)}
    val (n, k) = readLine()!!.trim().split(' ').map(String::toInt)
    val areas = Array(n){
        val (x1, y1, d1, x2, y2, d2) = readLine()!!.trim().split(' ').map(String::toInt)
        Pair(Point(x1, y1, d1), Point(x2, y2, d2))
    }
    val points = areas.flatMap { listOf(it.first, it.second) }
    val width = points.map(Point::x).doubling().toIntArray().apply{sort()}
    val height = points.map(Point::y).doubling().toIntArray().apply{sort()}
    val depth = points.map(Point::z).doubling().toIntArray().apply{sort()}
    val space = Array(4 * n){Array(4 * n){IntArray(4 * n){0}}}
    fun Point.toCompressed(): Point {
        return Point(lowerBound(width, x), lowerBound(height, y), lowerBound(depth, z))
    }
    for ((l, r) in areas) {
        val cl = l.toCompressed()
        val cr = r.toCompressed()
        space[cl.x][cl.y][cl.z]++
        space[cr.x + 1][cl.y][cl.z]--
        space[cl.x][cr.y + 1][cl.z]--
        space[cl.x][cl.y][cr.z + 1]--
        space[cl.x][cr.y + 1][cr.z + 1]++
        space[cr.x + 1][cl.y][cr.z + 1]++
        space[cr.x + 1][cr.y + 1][cl.z]++
        space[cr.x + 1][cr.y + 1][cr.z + 1]--
    }
    for (x in 1 until 4 * n) for (y in 0 until 4 * n) for (z in 0 until 4 * n) space[x][y][z] += space[x - 1][y][z]
    for (x in 0 until 4 * n) for (y in 1 until 4 * n) for (z in 0 until 4 * n) space[x][y][z] += space[x][y - 1][z]
    for (x in 0 until 4 * n) for (y in 0 until 4 * n) for (z in 1 until 4 * n) space[x][y][z] += space[x][y][z - 1]
    println(
            (0 until 4 * n - 1).map{x -> (0 until 4 * n - 1).map{y -> (0 until 4 * n - 1).filter{z -> space[x][y][z] >= k }.map{z ->
                (width[x + 1].toLong() - width[x]) * (height[y + 1].toLong() - height[y]) * (depth[z + 1].toLong() - depth[z])
            }.sum()}.sum()}.sum()
    )
}
operator fun <T> List<T>.component6(): T = this[5]
data class Point(val x: Int, val y: Int, val z: Int)
fun lowerBound(array: IntArray, target: Int): Int {
    var left = 0
    var right = array.size
    while(left < right){
        val mid = (left + right) / 2
        if (array[mid] < target) left = mid + 1
        else right = mid
    }
    return right
}
