#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int coun[105][105][105];
vector<int>x,y,z;
int rx[52][2], ry[52][2], rz[52][2];
int a[52],b[52],c[52],d[52],e[52],f[52];
int n,m;

int compress1(){
	sort(x.begin(), x.end());
	x.erase(unique(x.begin(), x.end()), x.end());
	for(int i = 0;i < n;i++){
		rx[i][0] = find(x.begin(),x.end(),a[i])-x.begin();
		rx[i][1] = find(x.begin(),x.end(),d[i])-x.begin();
	}
	return 0;
}

int compress2(){
	sort(y.begin(), y.end());
	y.erase(unique(y.begin(), y.end()), y.end());
	for(int i = 0;i < n;i++){
		ry[i][0] = find(y.begin(),y.end(),b[i])-y.begin();
		ry[i][1] = find(y.begin(),y.end(),e[i])-y.begin();
	}
	return 0;
}

int compress3(){
	sort(z.begin(), z.end());
	z.erase(unique(z.begin(), z.end()), z.end());
	for(int i = 0;i < n;i++){
		rz[i][0] = find(z.begin(),z.end(),c[i])-z.begin();
		rz[i][1] = find(z.begin(),z.end(),f[i])-z.begin();
	}
	return 0;
}

int main()
{
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d %d %d %d %d %d",&a[i],&b[i],&c[i],&d[i],&e[i],&f[i]);
		x.push_back(a[i]);
       x.push_back(d[i]);
       y.push_back(b[i]);
       y.push_back(e[i]);
       z.push_back(c[i]);
       z.push_back(f[i]);
	}
	compress1();
	compress2();
	compress3();
	for(int i = 0;i < n;i++){
	for(int tx=rx[i][0];tx<rx[i][1];tx++)
    {
      for(int ty=ry[i][0];ty<ry[i][1];ty++)
        {
          for(int tz=rz[i][0];tz<rz[i][1];tz++)
        {
          coun[tx][ty][tz]++;
        }
        }
    }
	}
  long long ans=0;
  for(int i=0;i<=100;i++)
    {
      for(int j=0;j<=100;j++)
    {
      for(int k=0;k<=100;k++)
        {
          if(coun[i][j][k]>=m)
        {
          long long s1=(x[i+1]-x[i]),s2=(y[j+1]-y[j]),s3=(z[k+1]-z[k]);
          ans+=s1*s2*s3;
        }
        }
    }
    }
	//long long ans = 0;
	printf("%lld\n",ans);
	return 0;
}