#include <vector>
#include <queue>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstdint>

constexpr uint32_t N_MAX = 50;
uint32_t N,X,Y,Z;
int32_t K;
uint32_t p1x[N_MAX];
uint32_t p2x[N_MAX];
uint32_t p1y[N_MAX];
uint32_t p2y[N_MAX];
uint32_t p1z[N_MAX];
uint32_t p2z[N_MAX];
int8_t graph[N_MAX*2][N_MAX*2][N_MAX*2];//z,y,x
uint32_t width_x[N_MAX*2];
uint32_t width_y[N_MAX*2];
uint32_t width_z[N_MAX*2];

uint32_t com(uint32_t a1[],uint32_t a2[], uint32_t length,uint32_t width_out[])
{
	static uint32_t tmp_arr[N_MAX*2];
	auto iter = tmp_arr;
	for(uint32_t i = 0;i < length;++i){
		*iter++ = a1[i];
		*iter++ = a2[i];
	}
	std::sort(tmp_arr, iter);
	iter = std::unique(tmp_arr, iter);
	for(uint32_t i = 0;i < length;++i){
		a1[i] = std::lower_bound(tmp_arr, iter, a1[i]) - tmp_arr;
	}
	for(uint32_t i = 0;i < length;++i){
		a2[i] = std::lower_bound(tmp_arr, iter, a2[i]) - tmp_arr;
	}
	length = iter - tmp_arr;
	for(uint32_t i = 0;i < length-1;++i){
		width_out[i] = tmp_arr[i+1] - tmp_arr[i];
	}
	return length;
}

int main()
{
	std::cin >> N>>K;
	for(uint32_t i = 0;i < N;++i){
		std::cin >> p1x[i]>>p1y[i]>>p1z[i]>>p2x[i]>>p2y[i]>>p2z[i];
	}
	X = com(p1x,p2x,N, width_x);
	#if 0
	std::cout <<"------------------------\n";
	for(uint32_t x = 0;x < N;++x){
		std::cout<<'(' << (int)(p1x[x]) <<','<<(int)(p2x[x])<< ')';
	}
	#endif
	Y = com(p1y,p2y,N, width_y);
	Z = com(p1z,p2z,N, width_z);
	
	//いもす
	for(uint32_t i = 0;i < N;++i){
		++graph[p1z[i]][p1y[i]][p1x[i]];
		--graph[p1z[i]][p1y[i]][p2x[i]];
		--graph[p1z[i]][p2y[i]][p1x[i]];
		++graph[p1z[i]][p2y[i]][p2x[i]];
		--graph[p2z[i]][p1y[i]][p1x[i]];
		++graph[p2z[i]][p1y[i]][p2x[i]];
		++graph[p2z[i]][p2y[i]][p1x[i]];
		--graph[p2z[i]][p2y[i]][p2x[i]];
	}
	#if 0
	std::cout<<"("<<X<<','<<Y<<','<<Z<<')' <<"------------------------\n";
	for(uint32_t z = 0;z < Z;++z){
	for(uint32_t y = 0;y < Y;++y){for(uint32_t x = 0;x < X;++x){
		std::cout << (int)graph[z][y][x] << ' ';
	}std::cout <<'\n';}std::cout <<"------------------------\n";}
	#endif
	for(uint32_t z = 0;z < Z;++z)
	for(uint32_t y = 0;y < Y;++y)for(uint32_t x = 1;x < X;++x){
		graph[z][y][x] += graph[z][y][x-1];
	}
	for(uint32_t z = 0;z < Z;++z)
	for(uint32_t y = 1;y < Y;++y)for(uint32_t x = 0;x < X;++x){
		graph[z][y][x] += graph[z][y-1][x];
	}
	#if 0
	std::cout<<"("<<X<<','<<Y<<','<<Z<<')' <<"------------------------\n";
	for(uint32_t z = 0;z < Z;++z){
	for(uint32_t y = 0;y < Y;++y){for(uint32_t x = 0;x < X;++x){
		std::cout << (int)graph[z][y][x] << ' ';
	}std::cout <<'\n';}std::cout <<"------------------------\n";}
	#endif
	for(uint32_t z = 1;z < Z;++z)
	for(uint32_t y = 0;y < Y;++y)for(uint32_t x = 0;x < X;++x){
		graph[z][y][x] += graph[z-1][y][x];
	}
	#if 0
	std::cout<<"("<<X<<','<<Y<<','<<Z<<')' <<"------------------------\n";
	for(uint32_t z = 0;z < Z;++z){
	for(uint32_t y = 0;y < Y;++y){for(uint32_t x = 0;x < X;++x){
		std::cout << (int)graph[z][y][x] << ' ';
	}std::cout <<'\n';}std::cout <<"------------------------\n";}
	#endif
	//K以上をカウント
	uint64_t count = 0;
	for(uint32_t z = 0;z < Z;++z)
	for(uint32_t y = 0;y < Y;++y)for(uint32_t x = 0;x < X;++x){
		if(K <= graph[z][y][x]){
			count += (uint64_t)(width_x[x])*(uint64_t)(width_y[y])
				*(uint64_t)(width_z[z]);
		}
	}
	std::cout << count << std::endl;
}

Measured memory_bytes: 4108