#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif
#define LDcout(x,n) fixed<<setprecision(n)<<x

#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
int dp[100][100][100];
vint zip(vint v,vint w){
	v.insert(v.end(),ALL(w));
	sort(ALL(v));
	v.erase(unique(ALL(v)),v.end());
	return v;
}
int pos(vint &v,int val){
	return lower_bound(ALL(v),val)-v.begin();
}
void mainmain(){
	int N,K;
	cin>>N>>K;
	vint x1(N);
	vint x2(N);
	vint y1(N);
	vint y2(N);
	vint z1(N);
	vint z2(N);
	rep(i,N){
		cin>>x1[i]>>y1[i]>>z1[i]>>x2[i]>>y2[i]>>z2[i];
	}
	vint xx=zip(x1,x2);
	vint yy=zip(y1,y2);
	vint zz=zip(z1,z2);
	rep(i,N){
		int xs,ys,zs;
		int xe,ye,ze;
		xs=pos(xx,x1[i]);
		ys=pos(yy,y1[i]);
		zs=pos(zz,z1[i]);
		xe=pos(xx,x2[i]);
		ye=pos(yy,y2[i]);
		ze=pos(zz,z2[i]);
		dp[xs][ys][zs]=dp[xe][ye][zs]=1;
		dp[xs][ye][zs]=dp[xe][ys][zs]=-1;
		dp[xs][ys][ze]=dp[xe][ye][ze]=-1;
		dp[xs][ye][ze]=dp[xe][ys][ze]=1;
	}
	reep(i,1,100){
		rep(j,100){
			rep(k,100){
				dp[i][j][k]+=dp[i-1][j][k];
			}
		}
	}
	rep(i,100){
		reep(j,1,100){
			rep(k,100){
				dp[i][j][k]+=dp[i][j-1][k];
			}
		}
	}
	rep(i,100){
		rep(j,100){
			reep(k,1,100){
				dp[i][j][k]+=dp[i][j][k-1];
			}
		}
	}
	ll ans=0;
	rep(i,100){
		rep(j,100){
			rep(k,100){
				if(dp[i][j][k]>=K){
					ans+=(ll)(xx[i+1]-xx[i])*(yy[j+1]-yy[j])*(zz[k+1]-zz[k]);
					// cout<<i<<" "<<j<<" "<<k<<endl;
					// cout<<xx[i]<<" "<<xx[i+1]<<" "<<yy[j]<<" "<<yy[j+1]<<" "<<zz[k]<<" "<<zz[k+1]<<endl;
				}
			}
		}
	}
	cout<<ans<<endl;
}


signed main() {
	ios_base::sync_with_stdio(false);
  	cout<<fixed<<setprecision(0);
    mainmain();
}

Measured memory_bytes: 5120