#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstring>

using namespace std;
#define MAX_N 50
#define rep(i,n) for(int i=0;i<n;i++)

int W,H,D,N,K;
int X1[MAX_N],X2[MAX_N],Y1[MAX_N],Y2[MAX_N],D1[MAX_N],D2[MAX_N];
vector<int> xl,yl,dl;

int fld[MAX_N * 2][MAX_N*2][MAX_N*2];

int compress(int *x1,int *x2, int w,vector<int> *xs){
	
	rep(i,N){
			int tx1=x1[i], tx2=x2[i];
			xs->push_back(tx1);
			xs->push_back(tx2);
	}
	sort(xs->begin(),xs->end());
	xs->erase(unique(xs->begin(),xs->end()),xs->end());
	
	rep(i,N){
		x1[i] = find(xs->begin(),xs->end(),x1[i] )- xs->begin();
		x2[i] = find(xs->begin(),xs->end(),x2[i] )- xs->begin();
	}
	return xs->size();
	
}

void solve(){
	W=compress(X1,X2,W,&xl);
	H=compress(Y1,Y2,H,&yl);
	D=compress(D1,D2,D,&dl);

	memset(fld, 0, sizeof(fld));
	rep(i,N){
		for(int d=D1[i]; d<D2[i]; d++){
			for(int y = Y1[i]; y<Y2[i];y++){
				for(int x = X1[i]; x<X2[i];x++){
					fld[d][y][x]++;
				}
			}
		}
	}

	long long int ans=0;
	rep(d,D-1){
		rep(y,H-1){
			rep(x,W-1){
				if(fld[d][y][x]<K)continue;
				ans+=(long long int)(xl[x+1]-xl[x])*(long long int)(yl[y+1]-yl[y])*(long long int)(dl[d+1]-dl[d]);
				ans=ans;
			}
		}
	}

	printf("%lld\n",ans);
}

int main(){
	scanf("%d %d",&N,&K);
	W=H=D=1000000;
	rep(i,N){
		//int x1,x2,y1,y2,d1,d2;
		scanf("%d %d %d %d %d %d",&X1[i],&Y1[i],&D1[i],&X2[i],&Y2[i],&D2[i]);
	}
	solve();

	return 0;
}