#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <stack>
#include <climits>
#include <deque>
#include <bitset>
#include <cassert>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int dy[]={-1,0,1,0},dx[]={0,1,0,-1};
// adjust problem by problem
const double EPS=1e-8;
const double PI=acos(-1.0);
#ifdef __GNUC__
int popcount(int n){return __builtin_popcount(n);}
int popcount(ll n){return __builtin_popcountll(n);}
#endif
#ifndef __GNUC__
template<class T> int popcount(T n){int cnt=0;while(n){if(n%2)cnt++;n/=2;}return cnt;}
#endif
template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T> void PrintSeq(T &a,int sz){for(int i=0;i<sz;i++){cout<<a[i];if(sz==i+1)cout<<endl;else cout<<' ';}}
bool EQ(double a,double b){return abs(a-b)<EPS;}
void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}
vector<string> split(string str,char del){
  vector<string> res;
  for(int i=0,s=0;i<SIZE(str);i++){
    if(str[i]==del){if(i-s!=0)res.push_back(str.substr(s,i-s));s=i+1;}
    else if(i==SIZE(str)-1){res.push_back(str.substr(s));}
  }
  return res;
}



int N,K;
int X1[51],Y1[51],D1[51],X2[51],Y2[51],D2[51];

set<int> xset,yset,dset;
typedef pair<int,pii>  point;
typedef pair<point,point> tpl;
set<tpl> ps;

int main(){
  

  cin>>N>>K;
  for(int i=0;i<N;i++){
    cin>>X1[i]>>Y1[i]>>D1[i]>>X2[i]>>Y2[i]>>D2[i];
    xset.insert(X1[i]);
    yset.insert(Y1[i]);
    dset.insert(D1[i]);
    xset.insert(X2[i]);
    yset.insert(Y2[i]);
    dset.insert(D2[i]);
  }
  for(int i=0;i<N;i++){
    vector<int> xs,ys,ds;
    xs.push_back(X1[i]),xs.push_back(X2[i]);
    ys.push_back(Y1[i]),ys.push_back(Y2[i]);
    ds.push_back(D1[i]),ds.push_back(D2[i]);
    for(set<int>::iterator it1=xset.begin();it1!=xset.end();it1++){
      int x=*it1;
      if(X1[i]<x&&X2[i]>x){
        xs.push_back(x);
      }
    }
    for(set<int>::iterator it2=yset.begin();it2!=yset.end();it2++){
      int y=*it2;
      if(Y1[i]<y&&Y2[i]>y){
        ys.push_back(y);
      }
    }
    for(set<int>::iterator it3=dset.begin();it3!=dset.end();it3++){
      int d=*it3;
      if(D1[i]<d&&D2[i]>d){
        ds.push_back(d);
      }
    }
    sort(xs.begin(),xs.end());
    sort(ys.begin(),ys.end());
    sort(ds.begin(),ds.end());
    for(int k=1;k<(int)ds.size();k++){
      for(int j=1;j<(int)ys.size();j++){
        for(int i=1;i<(int)xs.size();i++){
          int minx=xs[i-1];
          int miny=ys[j-1];
          int mind=ds[k-1];
          int maxx=xs[i];
          int maxy=ys[j];
          int maxd=ds[k];
          ps.insert(make_pair(make_pair(minx,pii(miny,mind))
                              ,make_pair(maxx,pii(maxy,maxd))));
        }
      }
    }
  }
  ll ans=0;
  for(set<tpl>::iterator it=ps.begin();it!=ps.end();it++){
    point p1=it->first;
    point p2=it->second;
    int cnt=0;
    ll minx=p1.first;
    ll miny=p1.second.first;
    ll mind=p1.second.second;
    ll maxx=p2.first;
    ll maxy=p2.second.first;
    ll maxd=p2.second.second;
    for(int i=0;i<N;i++){
      if(X1[i]<=minx&&maxx<=X2[i]
         &&Y1[i]<=miny&&maxy<=Y2[i]
         &&D1[i]<=mind&&maxd<=D2[i]){
        cnt++;
      }
    }
    if(cnt>=K)ans+=(maxx-minx)*(maxy-miny)*(maxd-mind);
  }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 47800