#include<bits/stdc++.h>
#define e(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,q,p;long long x[110],y[110],z[110],a[110][2],b[110][2],c[110][2],s;
int main(){
	cin>>n>>q;
	e(i,2*n){cin>>x[i]>>y[i]>>z[i];
		a[i/2][i%2]=x[i],b[i/2][i%2]=y[i],c[i/2][i%2]=z[i];
	}sort(x,x+n*2);sort(y,y+n*2);sort(z,z+n*2);s=0;
	e(i,n*2-1)e(j,n*2-1)e(k,n*2-1){p=0;
	e(t,n){bool o=1;e(r,2){
		if(a[t][0]>x[i+r]||x[i+r]>a[t][1])o=0;
		if(b[t][0]>y[j+r]||y[j+r]>b[t][1])o=0;
		if(c[t][0]>z[k+r]||z[k+r]>c[t][1])o=0;
	}if(o)p++;
	}if(p>=q)s+=(x[i+1]-x[i])*(y[j+1]-y[j])*(z[k+1]-z[k]);
}cout<<s<<endl;
return 0;
}