#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;

struct POINT {
	ll x1,y1,z1;
	ll x2,y2,z2;
	POINT(){}
	POINT(ll x1, ll y1, ll z1, ll x2, ll y2, ll z2):
	  x1(x1), y1(y1), z1(z1), x2(x2), y2(y2), z2(z2){};
};

int main(){
	ll n,k;
	cin >> n >> k;
	vector< ll > X,Y,Z;
	int memo[101][101][101];
	vector<POINT> p(n);
	for(int i=0;i<n;i++){
		int x1,y1,z1,x2,y2,z2;
		cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
		p[i] = POINT (x1,y1,z1,x2,y2,z2);
		X.push_back(x1); X.push_back(x2);
		Y.push_back(y1); Y.push_back(y2);
		Z.push_back(z1); Z.push_back(z2);
	}
	sort(X.begin(), X.end()); X.erase(unique(X.begin(), X.end()), X.end());
	sort(Y.begin(), Y.end()); Y.erase(unique(Y.begin(), Y.end()), Y.end());
	sort(Z.begin(), Z.end()); Z.erase(unique(Z.begin(), Z.end()), Z.end());
	for(int i = 0; i < n; i++){
	   int x1 = lower_bound(X.begin(), X.end(), p[i].x1) - X.begin();
	   int y1 = lower_bound(Y.begin(), Y.end(), p[i].y1) - Y.begin();
	   int z1 = lower_bound(Z.begin(), Z.end(), p[i].z1) - Z.begin();
	   int x2 = lower_bound(X.begin(), X.end(), p[i].x2) - X.begin();
	   int y2 = lower_bound(Y.begin(), Y.end(), p[i].y2) - Y.begin();
	   int z2 = lower_bound(Z.begin(), Z.end(), p[i].z2) - Z.begin();

	   for(int i = x1; i < x2; i++){
	     for(int j = y1; j < y2; j++){
	       for(int z = z1; z < z2; z++){
	         memo[i][j][z]++;
	       }
	     }
	   }
	 }
	 ll ret = 0;
	 for(int i = 0; i < 101; i++){
	   for(int j = 0; j < 101; j++){
	     for(int z = 0; z < 101; z++){
	       if(memo[i][j][z] >= k){
	         ret += (X[i + 1] - X[i]) * (Y[j + 1] - Y[j]) * (Z[z + 1] - Z[z]);
	       }
	     }
	   }
	 }
	 cout << ret << endl;
}