#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <complex>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORE(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
using namespace std;
typedef long long ll;
typedef map<ll,ll> mi;
typedef vector<ll> vi;
mi open[3],closed[3];
ll fish[50][2][3];
bool search(int x,int y,int z,int l){
	int num[3]={x,y,z};
	num[0]=x;
	num[1]=y;
	num[2]=z;
	REP(i,3){
		if(fish[l][0][i]<=num[i] && fish[l][1][i]>=num[i]+1)
		continue;
		return false;
	}
	return true;
}
int main() {
	ll N,K;
	vi points[3];
	cin >> N >> K;
	REP(i,N)
		REP(j,2)
			REP(k,3){
				cin >> fish[i][j][k];
				points[k].push_back(fish[i][j][k]);
			}
	REP(i,3){
	points[i].push_back(0);
	sort(points[i].begin(),points[i].end());
	int count =0;
	REP(j,(int)points[i].size())
		if(j==1 || points[i][j]!=points[i][j-1]){
			open[i].insert(mi::value_type(count,points[i][j]));
			closed[i].insert(mi::value_type(points[i][j],count));
			count++;
		}
	}
	REP(i,N)
		REP(j,2)
			REP(k,3){
				fish[i][j][k]=closed[k][fish[i][j][k]];
				
		}
	ll sum=0;
	REP(i,open[0].size()-1)
		REP(j,open[1].size()-1)
			REP(k,open[2].size()-1){
				int count=0;
				REP(l,N)
				count+=search(i,j,k,l);
				if(count>=K)
				sum+=(open[0][i+1]-open[0][i])*(open[1][j+1]-open[1][j])*(open[2][k+1]-open[2][k]);
			}
	cout << sum << endl;
	// your code goes here
	return 0;
}