#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <bits/stdc++.h>
#include <set>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <map>
#define ll long long
using namespace __gnu_pbds;
using namespace std;
template <class T>
using ordered_set = tree<T , null_type , less<T> , rb_tree_tag , tree_order_statistics_node_update>;
template <class T>
using ordered_set1 = tree<T , null_type , greater<T> , rb_tree_tag , tree_order_statistics_node_update>;
// less<T>/greater<T> = ascending/descending.
// less_equal<>/greater_equal<> for ordered multiset
// ordered_multiset note : s.find(), s.erase() don't work + s.upper_bound() and s.lower_bound() swap jobs;
void fastIO(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int arr[1002][1002]={};
int main() {
    fastIO();
    int n,k; cin>>n>>k;
    while (n--) {
        int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2;
        arr[y1][x1]++;
        arr[y2+1][x1]--;
        arr[y1][x2+1]--;
        arr[y2+1][x2+1]++;
    }
    for (int i = 1; i<=1000; i++) {
        for (int j = 1; j<=1000; j++) {
            arr[i][j]+=arr[i-1][j];
        }
    }
    for (int i = 1; i<=1000; i++) {
        for (int j = 1; j<=1000; j++) {
            arr[i][j]+=arr[i][j-1];
        }
    }
    int count = 0;
    for (int i = 1; i<=1000; i++) {
        for (int j = 1; j<=1000; j++) {
            if (arr[i][j]==k) count++;
        }
    }
    cout<<count;
}