#include <bits/stdc++.h>
#define N 51
using namespace std;
typedef long long ll;
int n,m;
int x[N],y[N],z[N];
int X[N],Y[N],Z[N];
int s[N],t[N],u[N];
int S[N],T[N],U[N];
int xd[201],yd[201],zd[201];


void compress(int a[51],int A[51],int b[51],int B[51],int c[201]){
  vector <int> v;
  for(int i=0;i<n;i++)v.push_back(a[i]),v.push_back(A[i]);
  sort(v.begin(),v.end());
  v.erase(unique(v.begin(),v.end()),v.end());
  for(int i=0;i<v.size();i++) c[i]=v[i];
  for(int i=0;i<n;i++){
    b[i]=lower_bound(v.begin(),v.end(),a[i])-v.begin();
    B[i]=lower_bound(v.begin(),v.end(),A[i])-v.begin();
  }
}

ll calc(){
  ll res=0;
  for(int i=0;i<101;i++) //x
    for(int j=0;j<101;j++)//y
      for(int k=0;k<101;k++){//z
	int cnt=0;
	for(int l=0;l<n;l++)cnt+=((s[l]<=i&&i<S[l])&&(t[l]<=j&&j<T[l])&&(u[l]<=k&&k<U[l]));
	if(cnt<m)continue;
	ll a=xd[i+1]-xd[i],b=yd[j+1]-yd[j],c=zd[k+1]-zd[k];
	res+=a*b*c;
      }
  return res;
}

int main(){
  cin>>n>>m;
  for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>z[i]>>X[i]>>Y[i]>>Z[i];
  compress(x,X,s,S,xd),compress(y,Y,t,T,yd),compress(z,Z,u,U,zd);
  cout << calc()<<endl;  
  return 0;
}