# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);


int n, k;
int x1[60], x2[60], y334[60], y2[60], d1[60], d2[60];

vector<LL>x, y, d;

int main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> x1[i] >> y334[i] >> d1[i] >> x2[i] >> y2[i] >> d2[i];
		x.emplace_back(x1[i]);
		x.emplace_back(x2[i]);
		y.emplace_back(y334[i]);
		y.emplace_back(y2[i]);
		d.emplace_back(d1[i]);
		d.emplace_back(d2[i]);
	}
	sort(x.begin(), x.end());
	sort(y.begin(), y.end());
	sort(d.begin(), d.end());

	LL ans = 0;
	for (int X = 0; X < x.size() - 1; X++) {
		for (int Y = 0; Y < y.size() - 1; Y++) {
			for (int D = 0; D < d.size() - 1; D++) {
				int count = 0;
				for (int i = 0; i < n; i++) {
					if (x1[i] <= x[X] && x[X + 1] <= x2[i] && y334[i] <= y[Y] && y[Y + 1] <= y2[i] && d1[i] <= d[D] && d[D + 1] <= d2[i]) count++;
				}
				if (count >= k)ans += (x[X + 1] - x[X]) * (y[Y + 1] - y[Y]) * (d[D + 1] - d[D]);
			}
		}
	}
	cout << ans << endl;
}