#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(void) {

	int N, K; cin >> N >> K;
	vector<vector<unsigned long long> > fishrange;
	vector<unsigned long long> x, y, d;

	unsigned long long volume = 0;

	for (int i = 0; i < N; i++) {
		vector<unsigned long long> range;
		int x1, y1, d1, x2, y2, d2; cin >> x1 >> y1 >> d1 >> x2 >> y2 >> d2;

		range.push_back(x1); range.push_back(y1); range.push_back(d1);
		range.push_back(x2); range.push_back(y2); range.push_back(d2);

		x.push_back(x1); x.push_back(x2);
		y.push_back(y1); y.push_back(y2);
		d.push_back(d1); d.push_back(d2);

		fishrange.push_back(range);
	}

	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(d.begin(), d.end()); d.erase(unique(d.begin(), d.end()), d.end());

	for (int i = 0; i < (x.size() - 1); i++) {
		for (int j = 0; j < (y.size() - 1); j++) {

			for (int t = 0; t < (d.size() - 1); t++) {

				int count = 0;

				for (int s = 0; s < N; s++) {
					if (x[i] >= fishrange[s][0] && x[i + 1] <= fishrange[s][3] &&
						y[j] >= fishrange[s][1] && y[j + 1] <= fishrange[s][4] &&
						d[t] >= fishrange[s][2] && d[t + 1] <= fishrange[s][5])

						count++;
				}

				if (count >= K) volume += (x[i + 1] - x[i])*(y[j + 1] - y[j])*(d[t + 1] - d[t]);

			}
		}
	}

	cout << volume << endl;

	return 0;

}
