// Arup Guha
// 3/10/2019
// Solution to 2019 February USACO Silver Problem: Painting the Barn

import java.util.*;
import java.io.*;

public class paintbarn {
	
	final public static int MAX = 1001;

	public static int n;
	public static int k;
	public static int[] list;
	public static int[][] cumfreq;
	
	public static void main(String[] args) throws Exception {
	
		// Get basic info.
		BufferedReader stdin = new BufferedReader(new FileReader("paintbarn.in"));
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		n = Integer.parseInt(tok.nextToken());
		k = Integer.parseInt(tok.nextToken());
		
		// Store info for cumulative frequency array. (Currently it's not one.)
		cumfreq = new int[MAX][MAX];
		for (int i=0; i<n; i++) {
			tok = new StringTokenizer(stdin.readLine());
			int x1 = Integer.parseInt(tok.nextToken());
			int y1 = Integer.parseInt(tok.nextToken());
			int x2 = Integer.parseInt(tok.nextToken());
			int y2 = Integer.parseInt(tok.nextToken());
			cumfreq[x2][y2]++;
			cumfreq[x1][y2]--;
			cumfreq[x2][y1]--;
			cumfreq[x1][y1]++;
		}
		
		int res = 0;
		
		// Sweep top to bottom i.
		for (int i=MAX-1; i>=0; i--) {
			
			// Make this row cumulative frequency.
			for (int j=MAX-1; j>=0; j--) {
				if (j < MAX-1) cumfreq[i][j] += cumfreq[i][j+1];
				if (i == MAX-1 && cumfreq[i][j] == k) res++;
			}
			
			// Don't need to add a second time if we're on the top (first iter).
			if (i == MAX-1) continue;
			
			// Here we are getting the results for this row all the way to the top.
			for (int j=MAX-1; j>=0; j--) {
				cumfreq[i][j] += cumfreq[i+1][j];
				if (cumfreq[i][j] == k) res++;
			}
			
		}
		
		// Output results.
		PrintWriter out = new PrintWriter(new FileWriter("paintbarn.out"));
		out.println(res);
		out.close();
		stdin.close();	
	}
	
}