#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define MAX_N 55
#define ll long long

ll N, K;

int compress(vector<ll>& x1, vector<ll>& x2,vector<ll>& xs) {
	for (int i = 0; i < N;i++) {
		xs.push_back(x1[i]);
		xs.push_back(x2[i]);
	}
	sort(xs.begin(), xs.end());
	xs.erase(unique(xs.begin(), xs.end()), xs.end());

	for (int i = 0; i < N;i++) {
		x1[i] = find(xs.begin(), xs.end(), x1[i]) - xs.begin();
		x2[i] = find(xs.begin(), xs.end(), x2[i]) - xs.begin();
	}
	return xs.size();
}

int main() {
	cin.tie(0);ios::sync_with_stdio(false);
	cin >> N >> K;
	vector<ll> X1(N), X2(N), Y1(N), Y2(N), D1(N), D2(N);
	vector<ll> xs, ys, ds;
	for (int i = 0; i < N;i++) {
		cin >> X1[i] >> Y1[i] >> D1[i] >> X2[i] >> Y2[i] >> D2[i];
	}
	ll X = compress(X1, X2, xs);
	ll Y = compress(Y1, Y2, ys);
	ll D = compress(D1, D2, ds);

	ll ans = 0;

	vector<vector<vector<ll>>> m(X, vector<vector<ll>>(Y, vector<ll>(D, 0)));
	for (int i = 0; i < N;i++) {
		for (int x = X1[i] + 1; x <= X2[i]; x++) {
			for (int y = Y1[i] + 1; y <= Y2[i]; y++) {
				for (int d = D1[i] + 1; d <= D2[i]; d++) {
					m[x][y][d]++;
				}
			}
		}
	}

	for (int x = 1; x < X; x++) {
		for (int y = 1; y < Y;y++) {
			for (int d = 1; d < D;d++) {
				if (m[x][y][d] >= K) {
					ll a_x, a_y, a_d;
					a_x = xs[x] - xs[x - 1];
					a_y = ys[y] - ys[y - 1];
					a_d = ds[d] - ds[d - 1];

					ans += a_x * a_y * a_d;
				}
			}
		}
	}

	cout << ans << endl;
}