#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
const int MAX_N = 60;
using namespace std;

typedef long long ll;
struct point {
  ll x, y, z;
};
typedef pair<point, point> P;

int main(void) {
  int N, K;
  vector<ll> x, y, z;
  cin >> N >> K;

  point p1, p2;
  vector<P> pair_points;
  for (int i = 0; i < N; i++) {
    cin >> p1.x >> p1.y >> p1.z
        >> p2.x >> p2.y >> p2.z;
    pair_points.push_back(P(p1, p2));

    x.push_back(p1.x);
    x.push_back(p2.x);
    y.push_back(p1.y);
    y.push_back(p2.y);
    z.push_back(p1.z);
    z.push_back(p2.z);
  }

  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  sort(z.begin(), z.end());
  map<ll, int> zipped_x, zipped_y, zipped_z;
  for (int i = 0; i < x.size(); i++) {
    zipped_x[x[i]] = i;
  }
  for (int i = 0; i < y.size(); i++) {
    zipped_y[y[i]] = i;
  }
  for (int i = 0; i < z.size(); i++) {
    zipped_z[z[i]] = i;
  }


  int ocean[MAX_N*2][MAX_N*2][MAX_N*2];
  for (int i = 0; i < MAX_N*2; i++) {
    for (int j = 0; j < MAX_N*2; j++) {
      for (int k = 0; k < MAX_N*2; k++) {
        ocean[i][j][k] = 0;
      }
    }
  }

  for (int i = 0; i < N; i++) {
    for (int j = zipped_x[pair_points[i].first.x]; j < zipped_x[pair_points[i].second.x]; j++) {
      for (int k = zipped_y[pair_points[i].first.y]; k < zipped_y[pair_points[i].second.y]; k++) {
        for (int l = zipped_z[pair_points[i].first.z]; l < zipped_z[pair_points[i].second.z]; l++) {
          ocean[j][k][l]++;
        }
      }
    }
  }

  ll ans = 0;
  for (int i = 0; i < x.size()-1; i++) {
    for (int j = 0; j < y.size()-1; j++) {
      for (int k = 0; k < z.size()-1; k++) {
        if (ocean[i][j][k] >= K) {
          ans += (x[i+1]-x[i])*(y[j+1]-y[j])*(z[k+1]-z[k]);
        }
      }
    }
  }

  cout << ans << endl;
  return 0;
}