#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

typedef long long Int;

int main(){
	const int MAX_N = 50;
	int N, K;
	int X1[MAX_N], Y1[MAX_N], D1[MAX_N], X2[MAX_N], Y2[MAX_N], D2[MAX_N];
	vector<int> X, Y, D;
	Int ans = 0;
	int k;
	
	scanf("%d%d", &N, &K);
	for(int i = 0; i < N; i++){
		scanf("%d%d%d%d%d%d", &X1[i], &Y1[i], &D1[i], &X2[i], &Y2[i], &D2[i]);
	}
	
	for(int i = 0; i < N; i++){
		X.push_back(X1[i] - 1); X.push_back(X1[i]);
		X.push_back(X2[i]); X.push_back(X2[i] + 1);
		Y.push_back(Y1[i] - 1); Y.push_back(Y1[i]);
		Y.push_back(Y2[i]); Y.push_back(Y2[i] + 1);
		D.push_back(D1[i] - 1); D.push_back(D1[i]);
		D.push_back(D2[i]); D.push_back(D2[i] + 1);
	}
	sort(X.begin(), X.end());
	sort(Y.begin(), Y.end());
	sort(D.begin(), D.end());
	X.erase(unique(X.begin(), X.end()), X.end());
	Y.erase(unique(Y.begin(), Y.end()), Y.end());
	D.erase(unique(D.begin(), D.end()), D.end());
	
	for(int d = 0; d < D.size() - 1; d++){
		for(int y = 0; y < Y.size() - 1; y++){
			for(int x = 0; x < X.size() - 1; x++){
				k = 0;
				for(int i = 0; i < N; i++){
					if(X1[i] <= X[x] && Y1[i] <= Y[y] && D1[i] <= D[d]
					 && X2[i] >= X[x + 1] && Y2[i] >= Y[y + 1] && D2[i] >= D[d + 1]){
						k++;
					}
				}
				if(k >= K){
					ans += (Int)(X[x + 1] - X[x]) * (Y[y + 1] - Y[y]) * (D[d + 1] - D[d]);
				}
			}
		}
	}
	
	printf("%lld\n", ans);
	
	return 0;
}