#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }




int N, K;



const int MAX_N = 110;
long long con[MAX_N][MAX_N][MAX_N];
vector<long long> xpl, ypl, zpl;

long long merge(vector<pair<vector<long long>, vector<long long> > > rec) {
    map<long long,int> xma, yma, zma;
    xpl.clear(); ypl.clear(); zpl.clear();
    for (int i = 0; i < rec.size(); ++i) {
        long long x1 = rec[i].first[0], x2 = rec[i].second[0];
        long long y1 = rec[i].first[1], y2 = rec[i].second[1];
        long long z1 = rec[i].first[2], z2 = rec[i].second[2];
        xma[x1]++; xma[x2]++; yma[y1]++; yma[y2]++; zma[z1]++; zma[z2]++;
    }
    int nx = 0;
    for(map<long long,int>::iterator it = xma.begin(); it != xma.end(); ++it) {
        it->second = nx++; xpl.push_back(it->first);
    }
    int ny = 0;
    for(map<long long,int>::iterator it = yma.begin(); it != yma.end(); ++it) { 
        it->second = ny++; ypl.push_back(it->first);
    }
    int nz = 0;
    for(map<long long,int>::iterator it = zma.begin(); it != zma.end(); ++it) { 
        it->second = nz++; zpl.push_back(it->first);
    }
    
    memset(con, 0, sizeof(con));
    for (int i = 0; i < rec.size(); ++i) {
        int x1 = xma[rec[i].first[0]], x2 = xma[rec[i].second[0]];
        int y1 = yma[rec[i].first[1]], y2 = yma[rec[i].second[1]];
        int z1 = zma[rec[i].first[2]], z2 = zma[rec[i].second[2]];
        con[x1][y1][z1]++; con[x1][y2][z1]--; con[x2][y1][z1]--; con[x2][y2][z1]++;
        con[x1][y1][z2]--; con[x1][y2][z2]++; con[x2][y1][z2]++; con[x2][y2][z2]--;
    }
    for (int i = 0; i < nx; ++i) for (int j = 0; j < ny; ++j) for (int k = 0; k < nz; ++k)
        con[i+1][j][k] += con[i][j][k];
    for (int i = 0; i < nx; ++i) for (int j = 0; j < ny; ++j) for (int k = 0; k < nz; ++k) 
        con[i][j+1][k] += con[i][j][k];
    for (int i = 0; i < nx; ++i) for (int j = 0; j < ny; ++j) for (int k = 0; k < nz; ++k) 
        con[i][j][k+1] += con[i][j][k];
    
    long long res = 0;
    for (int i = 0; i < nx; ++i) for (int j = 0; j < ny; ++j) for (int k = 0; k < nz; ++k) if (con[i][j][k] >= K) 
        res += (xpl[i+1]-xpl[i]) * (ypl[j+1]-ypl[j]) * (zpl[k+1]-zpl[k]);
    
    return res;
}





int main() {
    while (cin >> N >> K) {
        vector<pair<vector<long long>, vector<long long> > > rec(N);
        for (int i = 0; i < N; ++i) {
            vector<long long> lo(3), hi(3);
            cin >> lo[0] >> lo[1] >> lo[2] >> hi[0] >> hi[1] >> hi[2];
            rec[i] = MP(lo, hi);
        }
        long long res = merge(rec);
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 11664