#include <iostream>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int ary[110][110][110]={};
int x1[60],x2[60],yy1[60],y2[60],d1[60],d2[60];
set<int> X,Y,D;
map<int,int> mx,nmx,my,nmy,md,nmd;
int main(){
	set<int>::iterator it;
	int N,K,xc,yc,dc,ax1,ax2,ayy1,ay2,ad1,ad2;
	cin>>N>>K;
	for(int i=0;i<N;i++){
		cin>>x1[i]>>yy1[i]>>d1[i]>>x2[i]>>y2[i]>>d2[i];
		X.insert(x1[i]);X.insert(x2[i]);
		Y.insert(yy1[i]);Y.insert(y2[i]);
		D.insert(d1[i]);D.insert(d2[i]);
	}
	xc=X.size();
	yc=Y.size();
	dc=D.size();
	it=X.begin();
	for(int i=0;i<xc;i++){
		mx.insert(make_pair(*it,i));
		nmx.insert(make_pair(i,*it));
		it++;
	}
	it=Y.begin();
	for(int i=0;i<yc;i++){
		my.insert(make_pair(*it,i));
		nmy.insert(make_pair(i,*it));
		it++;
	}
	it=D.begin();
	for(int i=0;i<dc;i++){
		md.insert(make_pair(*it,i));
		nmd.insert(make_pair(i,*it));
		it++;
	}

	for(int i=0;i<N;i++){
		ax1=mx[x1[i]];
		ax2=mx[x2[i]];
		ayy1=my[yy1[i]];
		ay2=my[y2[i]];
		ad1=md[d1[i]];
		ad2=md[d2[i]];
		for(int j=ax1;j<ax2;j++){
			for(int k=ayy1;k<ay2;k++){
				for(int l=ad1;l<ad2;l++){
					ary[j][k][l]++;
				}
			}
		}
	}
	/*for(int i=0;i<xc-1;i++){
		cout<<i<<"??????"<<endl;
		for(int j=0;j<yc-1;j++){
			for(int k=0;k<dc-1;k++){
				cout<<ary[i][j][k]<<" ";
			}
			cout<<endl;
		}
	}*/
	long long int cnt=0;
	for(int i=0;i<xc-1;i++){
		for(int j=0;j<yc-1;j++){
			for(int k=0;k<dc-1;k++){
				if(ary[i][j][k]>=K){
					/*cout<<"("<<nmx[i]<<","<<nmy[j]<<","<<nmd[k]<<"),("<<nmx[i+1]<<","<<nmy[j+1]<<","<<nmd[k+1]<<")????????? cnt+="<<(long long)(nmx[i+1]-nmx[i])*(long long)(nmy[j+1]-nmy[j])*(long long)(nmd[k+1]-nmd[k])<<endl;*/
					cnt+=(long long)(nmx[i+1]-nmx[i])*(long long)(nmy[j+1]-nmy[j])*(long long)(nmd[k+1]-nmd[k]);
				}
			}
		}
	}
	cout<<cnt<<endl;
	return 0;
}