import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;

void main() {
    int[] input = readln.split.to!(int[]);
    int N = input[0];
    int K = input[1];
    long[][] data = new long[][N];
    bool[long][] aa = new bool[long][3];
    foreach(i; 0..N) {
        data[i] = readln.split.to!(long[]);
        foreach(j; 0..3) {
            aa[j][data[i][j]] = true;
            aa[j][data[i][j+3]] = true;
        }
    }
    long[long[3]] imos;
    long[][] keys = new long[][3];
    foreach(i; 0..3) keys[i] = aa[i].keys.sort;
    foreach(k0; keys[0]) foreach(k1; keys[1]) foreach(k2; keys[2]) {
        imos[[k0, k1, k2]] = 0;
    }
    foreach(e; data) {
        imos[[e[0], e[1], e[2]]]++;
        imos[[e[3], e[1], e[2]]]--;
        imos[[e[0], e[4], e[2]]]--;
        imos[[e[0], e[1], e[5]]]--;
        imos[[e[3], e[4], e[2]]]++;
        imos[[e[0], e[4], e[5]]]++;
        imos[[e[3], e[1], e[5]]]++;
        imos[[e[3], e[4], e[5]]]--;
    }
    foreach(i; 1..keys[0].length) {
        foreach(j; 0..keys[1].length) {
            foreach(k; 0..keys[2].length) {
                imos[[keys[0][i], keys[1][j], keys[2][k]]] += imos[[keys[0][i-1], keys[1][j], keys[2][k]]];
            }
        }
    }
    foreach(i; 0..keys[0].length) {
        foreach(j; 1..keys[1].length) {
            foreach(k; 0..keys[2].length) {
                imos[[keys[0][i], keys[1][j], keys[2][k]]] += imos[[keys[0][i], keys[1][j-1], keys[2][k]]];
            }
        }
    }
    foreach(i; 0..keys[0].length) {
        foreach(j; 0..keys[1].length) {
            foreach(k; 1..keys[2].length) {
                imos[[keys[0][i], keys[1][j], keys[2][k]]] += imos[[keys[0][i], keys[1][j], keys[2][k-1]]];
            }
        }
    }
    long ans = 0;
    foreach(i; 0..keys[0].length) {
        foreach(j; 0..keys[1].length) {
            foreach(k; 0..keys[2].length) {
                if (imos[[keys[0][i], keys[1][j], keys[2][k]]]>=K) {
                    ans += (keys[0][i+1]-keys[0][i])*(keys[1][j+1]-keys[1][j])*(keys[2][k+1]-keys[2][k]);
                }
            }
        }
    }
    ans.writeln;
}