#include<iostream>
#include<vector>
#include<set>
using namespace std;

struct Fish {int left, front, top, right, back, bottom;};

int main() {
    int N, K;
    cin >> N >> K;
    vector<Fish> fish(N);
    for(auto& f: fish) cin >> f.left >> f.front >> f.top >> f.right >> f.back >> f.bottom;

    set<long long int > tx, ty, tz;
    for(const auto& f: fish) {
        tx.insert(f.left);
        tx.insert(f.right);
        ty.insert(f.front);
        ty.insert(f.back);
        tz.insert(f.top);
        tz.insert(f.bottom);
    }
    vector<long long int> x(tx.begin(), tx.end()), y(ty.begin(), ty.end()), z(tz.begin(), tz.end());

    long long int answer = 0;
    for(int i = 1; i < x.size(); ++i) for(int j = 1; j < y.size(); ++j) for(int k = 1; k < z.size(); ++k) {
        int count = 0;
        for(const auto& f: fish)
            if((f.left < x[i] && x[i] <= f.right) && (f.front < y[j] && y[j] <= f.back) && (f.top < z[k] && z[k] <= f.bottom))
                ++count;
        if(count >= K) answer += (x[i] - x[i - 1]) * (y[j] - y[j - 1]) * (z[k] - z[k - 1]);
    }
    cout << answer << endl;
}