#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 51;

int n,K;
vector<int> X,Y,Z,X1,Y1,Z1,X2,Y2,Z2;
int flag[MAX_N*2][MAX_N*2][MAX_N*2];

int main()
{
	scanf("%d%d",&n,&K);
	rep(i,n){
		int ax,ay,az,bx,by,bz;
		scanf("%d%d%d%d%d%d",&ax,&ay,&az,&bx,&by,&bz);
		X.push_back(ax),X.push_back(bx);
		X1.push_back(ax),X2.push_back(bx);
		Y.push_back(ay),Y.push_back(by);
		Y1.push_back(ay),Y2.push_back(by);
		Z.push_back(az),Z.push_back(bz);
		Z1.push_back(az),Z2.push_back(bz);
	}
	sort(X.begin(),X.end());
	sort(Y.begin(),Y.end());
	sort(Z.begin(),Z.end());
	X.erase(unique(X.begin(),X.end()),X.end());
	Y.erase(unique(Y.begin(),Y.end()),Y.end());
	Z.erase(unique(Z.begin(),Z.end()),Z.end());
	rep(i,n){
		X1[i] = lower_bound(X.begin(),X.end(),X1[i])-X.begin();
		X2[i] = lower_bound(X.begin(),X.end(),X2[i])-X.begin();
		Y1[i] = lower_bound(Y.begin(),Y.end(),Y1[i])-Y.begin();
		Y2[i] = lower_bound(Y.begin(),Y.end(),Y2[i])-Y.begin();
		Z1[i] = lower_bound(Z.begin(),Z.end(),Z1[i])-Z.begin();
		Z2[i] = lower_bound(Z.begin(),Z.end(),Z2[i])-Z.begin();
		flag[X1[i]][Y1[i]][Z1[i]]++,flag[X1[i]][Y2[i]][Z1[i]]--;
		flag[X2[i]][Y1[i]][Z1[i]]--,flag[X2[i]][Y2[i]][Z1[i]]++;
		flag[X1[i]][Y1[i]][Z2[i]]--,flag[X1[i]][Y2[i]][Z2[i]]++;
		flag[X2[i]][Y1[i]][Z2[i]]++,flag[X2[i]][Y2[i]][Z2[i]]--;
	}
	rep(i,101){
		rep(j,101){
			rep(k,101){
				flag[i+1][j][k] += flag[i][j][k];
			}
		}
	}
	rep(i,101){
		rep(j,101){
			rep(k,101){
				flag[i][j+1][k] += flag[i][j][k];
			}
		}
	}
	rep(i,101){
		rep(j,101){
			rep(k,101){
				flag[i][j][k+1] += flag[i][j][k];
			}
		}
	}
	ll ans = 0;
	rep(i,X.size()-1){
		rep(j,Y.size()-1){
			rep(k,Z.size()-1){
				if(flag[i][j][k]>=K){
					ans += (ll)(X[i+1]-X[i])*(Y[j+1]-Y[j])*(Z[k+1]-Z[k]);
				}
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}