#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int compress(vector<ll>& v, vector<ll>& vs) {
    sort(vs.begin(), vs.end());
    vs.erase(unique(vs.begin(), vs.end()), vs.end());
    for(int i=0; i<v.size(); ++i) {
        v[i] = lower_bound(vs.begin(), vs.end(), v[i]) - vs.begin();
    }
    return vs.size();
}

int main() {
    int N, K;
    cin >> N >> K;
    vector<ll> x(2*N), y(2*N), z(2*N), xs(2*N), ys(2*N), zs(2*N);
    for(int i=0; i<N; ++i) {
        ll x1, y1, z1, x2, y2, z2;
        cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
        x[2*i] = xs[2*i] = x1, x[2*i+1] = xs[2*i+1] = x2;
        y[2*i] = ys[2*i] = y1, y[2*i+1] = ys[2*i+1] = y2;
        z[2*i] = zs[2*i] = z1, z[2*i+1] = zs[2*i+1] = z2;
    }
    int xsize = compress(x, xs);
    int ysize = compress(y, ys);
    int zsize = compress(z, zs);
    vector<vector<vector<int>>> sum(xsize, vector<vector<int>>(ysize, vector<int>(zsize)));
    for(int i=0; i<N; ++i) {
        for(int j=x[2*i]; j<x[2*i+1]; ++j) {
            for(int k=y[2*i]; k<y[2*i+1]; ++k) {
                for(int l=z[2*i]; l<z[2*i+1]; ++l) {
                    ++sum[j][k][l];
                }
            }
        }
    }
    ll res = 0;
    for(int i=0; i<xsize-1; ++i) {
        for(int j=0; j<ysize-1; ++j) {
            for(int k=0; k<zsize-1; ++k) {
                if(sum[i][j][k] >= K) {
                    res += (xs[i+1] - xs[i]) * (ys[j+1] - ys[j]) * (zs[k+1] - zs[k]);
                }
            }
        }
    }
    cout << res << endl;
}
