#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> mp;
typedef pair<mp ,int> mypair;
typedef pair<mp,pair<mp,mp> > tri;
typedef long long int ll;
void print(vector<int> a){
	for(int i=0;i<a.size();i++)cout<<a[i]<<' ';
	cout<<endl;
}
void print(vector<mp> a){
	for(int i=0;i<a.size();i++)cout<<" ("<<a[i].first<<" ,"<<a[i].second<<")" ;
	cout<<endl;
}
int main(){
	int n,m;
	cin>>n>>m;
	vector<int> x,y,d;
	vector<mp> mx(n),my(n),md(n);
	for(int i=0;i<n;i++){
		int x1,x2,y1,y2,d1,d2;
		cin>>x1>>y1>>d1>>x2>>y2>>d2;
		x.push_back(x1);
		x.push_back(x2);
		y.push_back(y1);
		y.push_back(y2);
		d.push_back(d1);
		d.push_back(d2);
		mx[i]=mp(x1,x2);
		my[i]=mp(y1,y2);
		md[i] =mp(d1,d2);
	}
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	sort(d.begin(),d.end() );
	//cout<<endl;
	//print(x);
	//print(y);
	//print(d);
	//cout<<endl;
	//print(mx);
	//print(my);
	//print(md);
	//cout<<endl;
	//sort(map.begin(),map.end() );
	ll  ans = 0;
	for(int i=0;i<x.size()-1;i++){
			if(x[i]==x[i+1])continue;
		for(int j=0;j<y.size()-1;j++){
				if(y[j]==y[j+1])continue;
			for(int k=0;k<d.size()-1;k++){
				if(d[k]==d[k+1])continue;
				int cnt=0;
				for(int t=0;t<n;t++){
					mp nx = mx[t];
					mp ny = my[t];
					mp nd = md[t];
					
					if(nx.first<=x[i]&&x[i+1]<=nx.second&&
							ny.first<=y[j]&&y[j+1]<=ny.second&&
							nd.first<=d[k]&&d[k+1]<=nd.second){
						cnt++;
					}
				}
				if(cnt>=m){
					ll tmp=(ll( x[i+1]-x[i]))*(ll(y[j+1]-y[j]) )*(ll(d[k+1]-d[k]) );
					//cout<<x[i]<<' '<<y[j]<<' '<<d[k]<<" "<<tmp<<endl;
					ans+=tmp;
				}
			}	
		}
	}
	cout<<ans<<endl;

	return 0;
}

