import std.stdio;
import core.stdc.stdio;
import std.algorithm;

struct cube{
	int x1;
	int x2;
	int y1;
	int y2;
	int z1;
	int z2;
}

int find(int[] d,int t){
	for(int i=0;i<d.length;i++)
		if(d[i] == t)
			return i;
	return -1;
}

void main(){
	int n,k;
	int[] xs,ys,zs;
	cube[] cs;
	scanf("%d%d",&n,&k);
	xs = new int[n*2];
	ys = new int[n*2];
	zs = new int[n*2];
	cs = new cube[n];
	for(int i=0;i<n;i++){
		scanf("%d%d%d%d%d%d",&cs[i].x1,&cs[i].y1,&cs[i].z1,&cs[i].x2,&cs[i].y2,&cs[i].z2);
		xs[i*2] = cs[i].x1;
		xs[i*2+1] = cs[i].x2;
		ys[i*2] = cs[i].y1;
		ys[i*2+1] = cs[i].y2;
		zs[i*2] = cs[i].z1;
		zs[i*2+1] = cs[i].z2;
	}
	sort(xs);
	sort(ys);
	sort(zs);
	//xs.writeln;
	//ys.writeln;
	//zs.writeln;
	int[] count =  new int[n*n*n*8];
	for(int i=0;i<n;i++){
		int xl = xs.find(cs[i].x1);
		int xr = xs.find(cs[i].x2);
		int yl = ys.find(cs[i].y1);
		int yr = ys.find(cs[i].y2);
		int zl = zs.find(cs[i].z1);
		int zr = zs.find(cs[i].z2);
		for(int x=xl;x<xr;x++){
			for(int y=yl;y<yr;y++){
				for(int z=zl;z<zr;z++){
					count[(x*n*2+y)*n*2+z]++;
				}
			}
		}
	}
	long ans=0;
	for(int x=0;x<n*2-1;x++){
		long xd = xs[x+1]-xs[x];
		for(int y=0;y<n*2-1;y++){
			long yd = ys[y+1]-ys[y];
			for(int z=0;z<n*2-1;z++){
				long zd = zs[z+1]-zs[z];
				if(count[(x*n*2+y)*n*2+z]>=k){
				//	writeln(x," ",y," ",z," ",xd," ",yd," ",zd);
					ans += xd*yd*zd;
				}
			}
		}
	}
	printf("%lld\n",ans);
}