We have N points in a two-dimensional plane.

The coordinates of the i-th point (1 \leq i \leq N) are (x_i,y_i).

Let us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior.

Here, points on the sides of the rectangle are considered to be in the interior.

Find the minimum possible area of such a rectangle.  

-----Constraints-----
 - 2 \leq K \leq N \leq 50 
 - -10^9 \leq x_i,y_i \leq 10^9 (1 \leq i \leq N) 
 - x_i≠x_j (1 \leq i<j \leq N) 
 - y_i≠y_j (1 \leq i<j \leq N) 
 - All input values are integers. (Added at 21:50 JST)  

-----Input-----
Input is given from Standard Input in the following format:  
N K  
x_1 y_1
:  
x_{N} y_{N}

-----Output-----
Print the minimum possible area of a rectangle that satisfies the condition.  

-----Sample Input-----
4 4
1 4
3 3
6 2
8 1

-----Sample Output-----
21

One rectangle that satisfies the condition with the minimum possible area has the following vertices: (1,1), (8,1), (1,4) and (8,4).

Its area is (8-1) × (4-1) = 21.

Difficulty: MEDIUM

Solutions:
(n, k) = map(int, input().split())
point = []
for i in range(n):
	(x, y) = map(int, input().split())
	point.append((x, y))
point.sort()
ans = 10 ** 20
for i in range(n):
	for j in range(i + 1, n):
		y_list = []
		for p in range(i, j + 1):
			y_list.append(point[p][1])
		y_list.sort()
		yl = len(y_list)
		y_d = 10 ** 10
		if yl < k:
			continue
		else:
			for p in range(yl - k + 1):
				y_d = min(y_d, y_list[p + k - 1] - y_list[p])
		x_d = point[j][0] - point[i][0]
		temp = x_d * y_d
		ans = min(ans, temp)
print(ans)


(N, K) = map(int, input().split(' '))
points = [list(map(int, input().split(' '))) for i in range(N)]
X = list(set([x for (x, y) in points]))
Y = list(set([y for (x, y) in points]))
X.sort()
Y.sort()
ans = float('inf')
for (i, min_x) in enumerate(X):
	for max_x in X[i + 1:]:
		for (j, min_y) in enumerate(Y):
			for max_y in Y[j + 1:]:
				m = (max_x - min_x) * (max_y - min_y)
				internal_points = [(x, y) for (x, y) in points if min_x <= x <= max_x and min_y <= y <= max_y]
				if len(internal_points) >= K:
					ans = min(ans, m)
print(ans)


import itertools
(N, K) = map(int, input().split())
P = [tuple(map(int, input().split())) for _ in range(N)]
X = sorted([x for (x, _) in P])
Y = sorted([y for (_, y) in P])
dict_x = {v: k + 1 for (k, v) in enumerate(X)}
dict_y = {v: k + 1 for (k, v) in enumerate(Y)}
table = [[0] * (N + 1) for _ in range(N + 1)]
for (x, y) in P:
	table[dict_y[y]][dict_x[x]] = 1
for x in range(N + 1):
	for y in range(N):
		table[y + 1][x] += table[y][x]
for y in range(N + 1):
	for x in range(N):
		table[y][x + 1] += table[y][x]
ans = float('inf')
for (x1, x2) in itertools.combinations(range(N), 2):
	for (y1, y2) in itertools.combinations(range(N), 2):
		if table[y2 + 1][x2 + 1] - table[y2 + 1][x1] - table[y1][x2 + 1] + table[y1][x1] >= K:
			ans = min(ans, (X[x2] - X[x1]) * (Y[y2] - Y[y1]))
print(ans)


from itertools import product
from operator import itemgetter
(N, K) = map(int, input().split())
XY = []
(X, Y) = ([], [])
for _ in range(N):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
	XY.append([x, y])
X.sort()
Y.sort()
XY.sort(key=itemgetter(1))
ans = 10 ** 19
for (l, r, t) in product(X, X, Y):
	if l > r:
		continue
	cnt = -K
	for (x, y) in XY:
		if y < t:
			continue
		if l <= x <= r:
			cnt += 1
			if cnt >= 0:
				area = (r - l) * (y - t)
				if area < ans:
					ans = area
				break
print(ans)


(n, h) = list(map(int, input().split()))
(p, x, y) = ([], [], [])
z = float('inf')
for i in range(n):
	(a, b) = list(map(int, input().split()))
	p.append((a, b))
	x.append(a)
	y.append(b)
x.sort()
y.sort()
for i in range(n - 1):
	for j in range(i, n):
		for k in range(n - 1):
			(lx, rx, dy) = (x[i], x[j], y[k])
			c = 0
			t = []
			for (a, b) in p:
				if x[i] <= a <= x[j] and y[k] <= b:
					c += 1
					t.append(b)
			if h <= c:
				z = min(z, (x[j] - x[i]) * (sorted(t)[h - 1] - y[k]))
print(z)


(n, k) = map(int, input().split())
x = []
y = []
xy = []
for _ in range(n):
	(xx, yy) = map(int, input().split())
	xy.append((xx, yy))
	x.append(xx)
	y.append(yy)
xx = sorted(x)
yy = sorted(y)
ans = 10 ** 20
for sxi in range(n - 1):
	for syi in range(n - 1):
		for tyi in range(1, n):
			(sx, sy, ty) = (xx[sxi], yy[syi], yy[tyi])
			ax = sorted([xxx for (xxx, yyy) in xy if sx <= xxx and sy <= yyy <= ty])
			if len(ax) < k:
				continue
			tx = ax[k - 1]
			ans = min(ans, (tx - sx) * (ty - sy))
print(ans)


(N, K) = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(N)]
xy.sort()
ans = 10 ** 20
for l in range(N):
	for r in range(l, N, 1):
		tmp = []
		for i in range(l, r + 1, 1):
			tmp.append(xy[i][1])
		tmp.sort()
		for d in range(0, len(tmp) - K + 1, 1):
			ans = min(ans, (tmp[d + K - 1] - tmp[d]) * (xy[r][0] - xy[l][0]))
print(ans)


(n, k) = map(int, input().split())
xy = [list(map(int, input().split())) for _ in [0] * n]
xy = sorted(xy, key=lambda x: x[0])
temp = []
for i in range(n):
	for j in range(i + k - 1, n):
		temp.append([xy[j][0] - xy[i][0]] + sorted([y for (x, y) in xy[i:j + 1]]))
m = 10 ** 19
for t in temp:
	l = len(t) - 1
	for i in range(1, l - k + 2):
		m = min(m, t[0] * (t[i + k - 1] - t[i]))
print(m)


(n, k) = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
l.sort()
l1 = sorted(l, key=lambda x: x[1])
ans = float('INF')
for i in l:
	for j in l:
		if i[0] >= j[0]:
			continue
		for s in l1:
			count = 0
			for (w, h) in l1:
				if i[0] <= w <= j[0] and s[1] <= h:
					count += 1
				if count == k:
					ans = min(ans, (j[0] - i[0]) * (h - s[1]))
					break
print(ans)


(N, K) = list(map(int, input().split()))
pts = []
ys = []
for _ in range(N):
	(x, y) = list(map(int, input().split()))
	pts.append((x, y))
	ys.append(y)
pts.sort()
ys.sort()
ans = 10 ** 20
for (i, y1) in enumerate(ys):
	for y2 in ys[i + 1:]:
		for (j, (x1, _)) in enumerate(pts):
			num = 0
			for (x, y) in pts[j:]:
				if y1 <= y <= y2:
					num += 1
				if num >= K:
					area = (x - x1) * (y2 - y1)
					ans = min(ans, area)
					break
print(ans)


(N, K) = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(N)]
X = sorted([i[0] for i in xy])
Y = sorted([i[1] for i in xy])
ans = []
for i in range(N - 1):
	lx = X[i]
	for j in range(i + 1, N):
		rx = X[j]
		for k in range(N - 1):
			dy = Y[k]
			for l in range(k + 1, N):
				uy = Y[l]
				cnt = 0
				for (x, y) in xy:
					if lx <= x and x <= rx and (dy <= y) and (y <= uy):
						cnt += 1
				if cnt >= K:
					ans.append((rx - lx) * (uy - dy))
print(min(ans))


(n, k) = map(int, input().split())
f = [list(map(int, input().split())) for _ in range(n)]
f.sort()
ans = 1145141919810893364364
for i in range(n - k + 1):
	for j in range(i + k - 1, n):
		a = [f[l][1] for l in range(i, j + 1)]
		a.sort()
		for l in range(j - i - k + 2):
			ans = min(ans, (f[j][0] - f[i][0]) * (a[l + k - 1] - a[l]))
print(ans)


import sys
(N, K) = map(int, sys.stdin.readline().split())
A = sorted(([int(e) for e in sys.stdin.readline().split()] for _ in range(N)))
(x, y) = zip(*A)
Y = sorted(y)
r = (x[-1] - x[0]) * (Y[-1] - Y[0])
for i in range(N):
	for j in range(i + 1, N):
		for k in range(N):
			for l in range(k + 1, N):
				ly = Y[k]
				ry = Y[l]
				q = (x[j] - x[i]) * (ry - ly)
				if r > q and K <= j - i + 1 and (K <= sum((ly <= y[z] <= ry for z in range(i, j + 1)))):
					r = q
print(r)


import sys
stdin = sys.stdin
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
nn = lambda : list(stdin.readline().split())
ns = lambda : stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 6)
(n, k) = na()
xy = []
for i in range(n):
	(x, y) = na()
	xy.append((x, y))
xy.sort()
ans = 10000000000000000000000000000
for i in range(n):
	for j in range(i + 1, n):
		x = xy[j][0] - xy[i][0]
		yy = sorted(xy[i:j + 1], key=lambda x: x[1])
		for u in range(len(yy) - k + 1):
			y = yy[u + k - 1][1] - yy[u][1]
			ans = min(ans, y * x)
print(ans)


(N, K) = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort(key=lambda x: x[0])
ans = float('INF')
for i in range(N):
	for j in range(i + K - 1, N):
		W = XY[j][0] - XY[i][0]
		Y = [XY[x][1] for x in range(i, j + 1)]
		Y.sort()
		for (l, k) in zip(Y, Y[K - 1:]):
			H = k - l
			ans = min(ans, W * H)
print(ans)


(N, K) = list(map(int, input().split()))
X = []
Y = []
Z = []
for i in range(N):
	(x, y) = list(map(int, input().split()))
	X.append(x)
	Y.append(y)
	Z.append([x, y])
X.sort()
Y.sort()
min_rec = 10 ** 27
for i in range(N - 1):
	for j in range(i + 1, N):
		for k in range(N - 1):
			for l in range(k + 1, N):
				count = 0
				for n in range(N):
					if Z[n][0] >= X[i] and Z[n][0] <= X[j] and (Z[n][1] >= Y[k]) and (Z[n][1] <= Y[l]):
						count += 1
				if count == K:
					min_rec = min(min_rec, (X[j] - X[i]) * (Y[l] - Y[k]))
print(min_rec)


(n, k) = map(int, input().split())
points = []
for _ in range(n):
	(x, y) = map(int, input().split())
	points.append((x, y))
points.sort()
ans = float('inf')
for i in range(n - k + 1):
	for j in range(i + k - 1, n):
		y_sorted = sorted(points[i:j + 1], key=lambda x: x[1])
		height_min = float('inf')
		for l in range(j - i - k + 2):
			height_min = min(height_min, y_sorted[l + k - 1][1] - y_sorted[l][1])
			ans = min(ans, (points[j][0] - points[i][0]) * height_min)
print(ans)


from bisect import bisect_left
import sys
input = sys.stdin.readline

def main():
	(N, K) = map(int, input().split())
	XY = [list(map(int, input().split())) for _ in range(N)]
	Xs = []
	Ys = []
	for (x, y) in XY:
		Xs.append(x)
		Ys.append(y)
	Xs.sort()
	Ys.sort()
	points = [[0 for _ in range(N)] for _ in range(N)]
	for (x, y) in XY:
		ix = bisect_left(Xs, x)
		iy = bisect_left(Ys, y)
		points[ix][iy] += 1
	sumpoints = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
	for ix in range(1, N + 1):
		s = 0
		for iy in range(1, N + 1):
			if ix == 1:
				sumpoints[ix][iy] = points[ix - 1][iy - 1]
			if points[ix - 1][iy - 1] == 1:
				s = 1
			sumpoints[ix][iy] = sumpoints[ix - 1][iy] + s
	ans = int(8e+18)
	for lx in range(N - 1):
		for rx in range(lx + 1, N):
			for ly in range(N - 1):
				for ry in range(ly + 1, N):
					if sumpoints[rx + 1][ry + 1] - sumpoints[rx + 1][ly] - sumpoints[lx][ry + 1] + sumpoints[lx][ly] >= K:
						s = (Xs[rx] - Xs[lx]) * (Ys[ry] - Ys[ly])
						ans = min(ans, s)
	print(ans)

def __starting_point():
	main()
__starting_point()


from itertools import combinations
import sys
try:
	from typing import List
except ImportError:
	pass

def solve(N: int, K: int, x: 'List[int]', y: 'List[int]'):
	pts = sorted(zip(x, y))
	ys = sorted(y)
	ans = float('inf')
	for (y1, y2) in combinations(ys, 2):
		xs = [x for (x, y) in pts if y1 <= y <= y2]
		if len(xs) >= K:
			ans = min(ans, (y2 - y1) * min((x2 - x1 for (x1, x2) in zip(xs, xs[K - 1:]))))
	print(ans)

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	N = int(next(tokens))
	K = int(next(tokens))
	x = [int()] * N
	y = [int()] * N
	for i in range(N):
		x[i] = int(next(tokens))
		y[i] = int(next(tokens))
	solve(N, K, x, y)

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
P = [list(map(int, input().split())) for _ in range(n)]
X = sorted(list(map(lambda x: x[0], P)))
Y = sorted(list(map(lambda x: x[1], P)))
s = (X[0] - X[-1]) * (Y[0] - Y[-1])
ans = 0
for r in range(n - 1, 0, -1):
	for l in range(r):
		for u in range(n - 1, 0, -1):
			for b in range(u):
				c = 0
				for p in P:
					if X[l] <= p[0] <= X[r] and Y[b] <= p[1] <= Y[u]:
						c += 1
				if c >= k:
					s = min(s, (X[r] - X[l]) * (Y[u] - Y[b]))
				else:
					break
		if u == n - 1 and b == 0 and (c < k):
			break
print(s)


(n, k) = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(n)]
INF = 10 ** 19
xy.sort()
ans = INF
for i in range(n):
	for j in range(i + k - 1, n):
		width = xy[j][0] - xy[i][0]
		y = [xy[idx][1] for idx in range(i, j + 1)]
		y.sort()
		for (e1, e2) in zip(y, y[k - 1:]):
			height = e2 - e1
			area = width * height
			ans = min(ans, area)
print(ans)


import itertools
(N, K) = map(int, input().split())
XY = [[int(x) for x in input().split()] for _ in range(N)]
XY.sort()
(X, Y) = zip(*XY)
min_area = 5 * 10 ** 18
for (left, right) in itertools.combinations(range(N), 2):
	width = X[right] - X[left]
	pts = sorted(XY[left:right + 1], key=lambda xy: xy[1])
	for D in range(len(pts)):
		if D + K - 1 >= len(pts):
			break
		y_max = pts[D + K - 1][1]
		y_min = pts[D][1]
		area = (y_max - y_min) * width
		if area < min_area:
			min_area = area
print(min_area)


(N, K) = list(map(int, input().split()))
p_list = [[0] * 2 for i in range(N)]
for i in range(N):
	(x, y) = list(map(int, input().split()))
	p_list[i] = [x, y]
p_list.sort()
ans = float('inf')
for i in range(N - K + 1):
	for j in range(i + K - 1, N):
		x = abs(p_list[j][0] - p_list[i][0])
		y_list = []
		for k in range(i, j + 1):
			y_list.append(p_list[k][1])
		y_list.sort()
		for k in range(len(y_list) - K + 1):
			ans = min(ans, x * abs(y_list[k + K - 1] - y_list[k]))
print(ans)


import collections, itertools, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def S():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

def LS():
	return input().split()

def resolve():
	(N, K) = LI()
	xy = [LI() for _ in range(N)]
	x_coord = [i[0] for i in xy]
	x_coord.sort()
	x_val_num = {x_coord[i]: i for i in range(N)}
	y_coord = [i[1] for i in xy]
	y_coord.sort()
	y_val_num = {y_coord[i]: i for i in range(N)}
	xy_cnt = [[0] * N for _ in range(N)]
	for (x, y) in xy:
		xy_cnt[y_val_num[y]][x_val_num[x]] = 1
	xy_acm = [[0] * (N + 1) for _ in range(N + 1)]
	for i in range(N):
		for j in range(N):
			xy_acm[i + 1][j + 1] = xy_cnt[i][j] + xy_acm[i + 1][j] + xy_acm[i][j + 1] - xy_acm[i][j]
	ans = INF
	for (yl, yu) in itertools.combinations(list(range(N + 1)), 2):
		for (xl, xu) in itertools.combinations(list(range(N + 1)), 2):
			cnt = xy_acm[yu][xu] - xy_acm[yu][xl] - xy_acm[yl][xu] + xy_acm[yl][xl]
			if cnt >= K:
				ans = min((x_coord[xu - 1] - x_coord[xl]) * (y_coord[yu - 1] - y_coord[yl]), ans)
	print(ans)

def __starting_point():
	resolve()
__starting_point()


(N, K) = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
s = 10 ** 19
B = sorted(A, key=lambda x: x[0])
for i in range(N - K + 1):
	for j in range(K, N - i + 1):
		xmin = B[i][0]
		xmax = B[i + j - 1][0]
		By = sorted(B[i:i + j], key=lambda x: x[1])
		for k in range(len(By) - K + 1):
			ymin = By[k][1]
			ymax = By[k + K - 1][1]
			s = min(s, (xmax - xmin) * (ymax - ymin))
print(s)


from itertools import combinations as comb
(n, k) = map(int, input().split())
f = lambda x, y: (min(x, y), max(x, y))
o = [tuple(map(int, input().split())) for _ in range(n)]
v = float('inf')
for (a, b) in comb(range(n), 2):
	for (c, d) in comb(range(n), 2):
		(lx, rx) = f(o[a][0], o[b][0])
		(dy, uy) = f(o[c][1], o[d][1])
		cnt = 0
		for i in o:
			if lx <= i[0] <= rx and dy <= i[1] <= uy:
				cnt += 1
		if cnt >= k:
			v = min(v, (rx - lx) * (uy - dy))
print(v)


(N, K) = list(map(int, input().split()))
P = sorted([tuple(map(int, input().split())) for _ in range(N)])
ans = 1e+30
for lx in range(N):
	for rx in range(lx + K, N + 1):
		Q = sorted(P[lx:rx], key=lambda x: x[1])
		for ly in range(len(Q)):
			R = Q[ly:ly + K]
			if len(R) >= K:
				ans = min(ans, (P[rx - 1][0] - P[lx][0]) * (R[-1][1] - R[0][1]))
print(ans)


import bisect
from operator import itemgetter
(N, K) = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort(key=itemgetter(0))
(x, y) = list(zip(*XY))
ans = 10 ** 19
for l in range(N):
	for r in range(l, N):
		n = bisect.bisect_right(x, x[r]) - bisect.bisect_left(x, x[l])
		if n >= K:
			dx = x[r] - x[l]
			tmp = sorted(y[l:r + 1])
			for i in range(n - K + 1):
				dy = tmp[i + K - 1] - tmp[i]
				ans = min(ans, dx * dy)
print(ans)


(n, k) = map(int, input().split())
(P, X, Y) = ([], [], [])
for _ in range(n):
	(x, y) = map(int, input().split())
	P.append((x, y))
	X.append(x)
	Y.append(y)
ans = 10 ** 19
X.sort()
Y.sort()
for d in range(n - 1):
	for u in range(d, n):
		for l in range(n - 1):
			for r in range(n):
				(D, U, L, R) = (X[d], X[u], Y[l], Y[r])
				cnt = 0
				for i in P:
					if D <= i[0] <= U and L <= i[1] <= R:
						cnt += 1
				if cnt >= k:
					ans = min(ans, (U - D) * (R - L))
print(ans)


(n, m) = map(int, input().split())
x = [0] * n
y = [0] * n
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
ans = 10 ** 19
for i in range(n):
	for j in range(i, n):
		for k in range(j, n):
			for l in range(k, n):
				xl = min(x[i], x[j], x[k], x[l])
				xr = max(x[i], x[j], x[k], x[l])
				yl = min(y[i], y[j], y[k], y[l])
				yh = max(y[i], y[j], y[k], y[l])
				cnt = 0
				for c in range(n):
					cnt += xl <= x[c] <= xr and yl <= y[c] <= yh
				if cnt >= m:
					ans = min(ans, (xr - xl) * (yh - yl))
print(ans)


from itertools import product, combinations
(N, K) = map(int, input().split())
L = [tuple(map(int, input().split())) for i in range(N)]
ans = 10 ** 37

def f(i, j, k, l):
	n = 0
	s = min(L[j][0], L[i][0])
	t = max(L[j][0], L[i][0])
	u = min(L[k][1], L[l][1])
	w = max(L[k][1], L[l][1])
	for e in L:
		if s <= e[0] <= t and u <= e[1] <= w:
			n += 1
	if n >= K:
		return (t - s) * (w - u)
	return 10 ** 37
for (i, j) in combinations(range(N), 2):
	for (k, l) in combinations(range(N), 2):
		ans = min(ans, f(i, j, k, l))
print(ans)


import itertools
(N, K) = [int(_) for _ in input().split()]
XY = [[int(_) for _ in input().split()] for _ in range(N)]
(X, Y) = ([x for (x, y) in XY], [y for (x, y) in XY])
(X_s, Y_s) = (sorted(X), sorted(Y))
ans = float('inf')
for (x1, x2) in itertools.combinations(X_s, 2):
	for (y1, y2) in itertools.combinations(Y_s, 2):
		k = sum([x1 <= X[i] <= x2 and y1 <= Y[i] <= y2 for i in range(N)])
		if k >= K:
			ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


(n, k) = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
ax = sorted(a)
ans = 10 ** 19
for i in range(n - 1):
	for j in range(i + 1, n):
		a_use = ax[i:j + 1]
		xnum = len(a_use)
		sx = a_use[-1][0] - a_use[0][0]
		a_use.sort(key=lambda x: x[1])
		if xnum < k:
			continue
		for y1 in range(xnum - k + 1):
			y2 = y1 + k - 1
			s = sx * (a_use[y2][1] - a_use[y1][1])
			ans = min(ans, s)
print(ans)


import math
import heapq
import bisect
import numpy as np
from collections import Counter
(N, K) = map(int, input().split())
L = [tuple(map(int, input().split())) for i in range(N)]
L.sort()
ans = 10 ** 20
for lx in range(N):
	for rx in range(lx + 1, N + 1):
		L2 = L[lx:rx]
		L2 = sorted(L2, key=lambda x: x[1])
		for ly in range(len(L2)):
			L3 = L2[ly:ly + K]
			if len(L3) >= K:
				ans = min(ans, (L[rx - 1][0] - L[lx][0]) * (L3[-1][1] - L3[0][1]))
print(ans)


import sys

def LI():
	return [int(x) for x in sys.stdin.readline().split()]
(N, K) = LI()
p = []
for i in range(N):
	(a, b) = LI()
	p.append((a, b, i))
sx = sorted(p)
ans = 10 ** 50
for (x, y, i) in sx:
	for (x2, y2, i2) in sx:
		if x2 <= x:
			continue
		points = sx.index((x2, y2, i2)) - sx.index((x, y, i)) + 1
		if points < K:
			continue
		sy = sorted(sx[sx.index((x, y, i)):sx.index((x2, y2, i2)) + 1], key=lambda sx: sx[1])
		for j in range(len(sy) - K + 1):
			if sy[j][1] <= y and y2 <= sy[j + K - 1][1]:
				ans = min(ans, (x2 - x) * (sy[j + K - 1][1] - sy[j][1]))
print(ans)


(N, K) = map(int, input().split())
A = sorted([list(map(int, input().split())) for n in range(N)])
ans = float('inf')
for i in range(N - K + 1):
	for j in range(i + K - 1, N):
		P = A[j][0] - A[i][0]
		C = sorted([a[1] for a in A[i:j + 1]])
		for k in range(j - i - K + 2):
			Q = C[k + K - 1] - C[k]
			ans = min(ans, P * Q)
print(ans)


(n, k) = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
x = [l[i][0] for i in range(n)]
x.sort()
y = [l[i][1] for i in range(n)]
y.sort()
ans = []
for i1 in range(n):
	for i2 in range(i1, n):
		for i3 in range(n):
			for i4 in range(i3, n):
				ct = 0
				for i5 in range(n):
					if min(x[i1], x[i2]) <= l[i5][0] <= max(x[i1], x[i2]) and min(y[i3], y[i4]) <= l[i5][1] <= max(y[i3], y[i4]):
						ct += 1
				if ct >= k:
					ans.append(abs(x[i1] - x[i2]) * abs(y[i3] - y[i4]))
print(min(ans))


import sys
import numpy as np
input = sys.stdin.readline

def main():
	(N, K) = list(map(int, input().split()))
	xy = [list(map(int, input().split())) for i in range(N)]
	xs = []
	ys = []
	xy = sorted(xy, key=lambda x: x[0])
	for i in range(N):
		xs.append(xy[i][0])
		xy[i][0] = i + 1
	xy = sorted(xy, key=lambda x: x[1])
	for i in range(N):
		ys.append(xy[i][1])
		xy[i][1] = i + 1
	sum_ = np.zeros((N + 1, N + 1), dtype=int)
	for i in range(N):
		(x, y) = xy[i]
		sum_[y][x] = 1
	for i in range(1, N + 1):
		sum_[i] += sum_[i - 1]
	for i in range(1, N + 1):
		sum_[:, i] += sum_[:, i - 1]
	ans = int(1e+20)
	for l in range(1, N + 1):
		no_three = True
		for r in range(N, l, -1):
			no_two = True
			for d in range(1, N + 1):
				no_one = True
				for u in range(d + 1, N + 1):
					tmp = sum_[u][r] - sum_[d - 1][r] - sum_[u][l - 1] + sum_[d - 1][l - 1]
					if tmp >= K:
						tmp = (xs[r - 1] - xs[l - 1]) * (ys[u - 1] - ys[d - 1])
						ans = min(ans, tmp)
						no_one = False
						break
				if no_one:
					break
				else:
					no_two = False
			if no_two:
				break
			else:
				no_three = False
		if no_three:
			break
	print(ans)

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
grid = []
gridx = set()
gridy = set()
for i in range(n):
	(x, y) = map(int, input().split())
	grid.append((x, y))
	gridx.add(x)
	gridy.add(y)
gridxl = sorted(gridx)
xlen = len(gridxl)
gridyl = sorted(gridy)
ylen = len(gridyl)
atable = [[0 for _ in range(ylen + 1)] for _ in range(xlen + 1)]
for i in range(n):
	(px, py) = grid[i]
	xid = gridxl.index(px)
	yid = gridyl.index(py)
	atable[yid + 1][xid + 1] = 1
for i in range(1, ylen + 1):
	for j in range(1, xlen + 1):
		atable[i][j] += atable[i][j - 1]
for j in range(1, xlen + 1):
	for i in range(1, ylen + 1):
		atable[i][j] += atable[i - 1][j]
gmin = 99999999999999999999
for x1 in range(1, xlen):
	for x2 in range(x1, xlen + 1):
		for y1 in range(1, ylen):
			for y2 in range(y1, ylen + 1):
				a = atable[y2][x2]
				b = atable[y1 - 1][x2]
				c = atable[y2][x1 - 1]
				d = atable[y1 - 1][x1 - 1]
				rui = a - b - c + d
				if rui >= k:
					r = (gridxl[x2 - 1] - gridxl[x1 - 1]) * (gridyl[y2 - 1] - gridyl[y1 - 1])
					if gmin > r:
						gmin = min(gmin, r)
print(gmin)


(N, K) = map(int, input().split())
l = [list(map(int, input().split())) for i in range(N)]
l.sort()
ans = []
for i in range(N):
	for j in range(i + 1, N + 1):
		nl = l[i:j]
		h = nl[-1][0] - nl[0][0]
		if len(nl) < K:
			continue
		nl.sort(key=lambda x: x[1])
		v = len(nl)
		for m in range(v - K + 1):
			ans.append(h * (nl[m + K - 1][1] - nl[m][1]))
print(min(ans))


(N, K) = map(int, input().split())
P = [list(map(int, input().split())) for i in range(N)]
P = sorted(P)
pi = list(enumerate(P))
minA = float('inf')
for (il, xyl) in pi[:N - 1]:
	left = xyl[0]
	for (ir, xyr) in pi[il + 1:]:
		right = xyr[0]
		insd = [xy_ for (i, xy_) in pi if xyl[0] <= xy_[0] <= xyr[0]]
		insd = sorted(insd, key=lambda xx: xx[1])
		in_L = len(insd)
		if in_L < K:
			continue
		for jd in range(in_L - K + 1):
			ju = jd + K - 1
			down = insd[jd][1]
			upper = insd[ju][1]
			minA = min(minA, (upper - down) * (right - left))
print(minA)


(N, K) = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort()
r = 10 ** 20
for xi0 in range(N - K + 1):
	for xi1 in range(K + xi0 - 1, N):
		x = XY[xi1][0] - XY[xi0][0]
		XY_ys = sorted(XY[xi0:xi1 + 1], key=lambda a: a[1])
		for yi0 in range(len(XY_ys) - K + 1):
			y = XY_ys[yi0 + K - 1][1] - XY_ys[yi0][1]
			r = min(r, x * y)
print(r)


from itertools import combinations
(N, K) = map(int, input().split())
xy = [tuple(map(int, input().split())) for i in range(N)]
ans = float('inf')
for (p1, p2) in combinations(xy, 2):
	x1 = p1[0]
	x2 = p2[0]
	if x2 < x1:
		(x1, x2) = (x2, x1)
	for (p3, p4) in combinations(xy, 2):
		y1 = p3[1]
		y2 = p4[1]
		if y2 < y1:
			(y1, y2) = (y2, y1)
		count = 0
		for (x, y) in xy:
			if x >= x1 and x <= x2 and (y >= y1) and (y <= y2):
				count += 1
		if count >= K:
			ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


(N, K) = map(int, input().split())
z = [tuple(map(int, input().split())) for _ in range(N)]
x = [i for (i, _) in z]
y = [j for (_, j) in z]
x.sort()
y.sort()
a = 10 ** 20
for i in range(N):
	for j in range(i + 1, N):
		for k in range(N):
			for l in range(k + 1, N):
				(l, r, d, u) = (x[i], x[j], y[k], y[l])
				if sum([1 for (v, w) in z if l <= v <= r and d <= w <= u]) >= K:
					a = min(a, (r - l) * (u - d))
print(a)


(N, K) = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(N)]
ans = float('inf')
for i in range(N):
	for j in range(N):
		for k in range(N):
			for l in range(N):
				x1 = xy[i][0]
				x2 = xy[j][0]
				y1 = xy[k][1]
				y2 = xy[l][1]
				cnt = 0
				if x1 < x2 and y1 < y2:
					for n in range(N):
						if x1 <= xy[n][0] <= x2 and y1 <= xy[n][1] <= y2:
							cnt += 1
					if cnt >= K:
						ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


(n, K) = map(int, input().split())
xy = []
x = []
y = []
for _ in range(n):
	(X, Y) = map(int, input().split())
	x.append(X + 10 ** 9)
	y.append(Y + 10 ** 9)
	xy.append((X + 10 ** 9, Y + 10 ** 9))
x.sort()
y.sort()
xy.sort()
num = [[0] * (n + 1) for _ in range(n + 1)]
for xx in xy:
	for i in range(n):
		if x[i] == xx[0]:
			break
	for j in range(n):
		if y[j] == xx[1]:
			break
	num[i + 1][j + 1] += 1
for i in range(n):
	for j in range(n):
		num[i + 1][j + 1] += num[i + 1][j]
for i in range(n):
	for j in range(n):
		num[i + 1][j + 1] += num[i][j + 1]
ans = 10 ** 20
for i in range(n):
	for j in range(n):
		for k in range(i + 1, n + 1):
			for l in range(j + 1, n + 1):
				if num[k][l] - num[i][l] - num[k][j] + num[i][j] >= K:
					r = (y[l - 1] - y[j]) * (x[k - 1] - x[i])
					ans = min(ans, r)
print(ans)


from itertools import combinations

def solve():
	(N, K) = map(int, input().split())
	vertices = [tuple(map(int, input().split())) for _ in [0] * N]
	sorted_v = sorted(vertices)
	result = float('inf')
	for l in combinations(sorted_v, min(4, K)):
		xs = sorted((x for (x, y) in l))
		ys = sorted((y for (x, y) in l))
		(min_x, max_x) = (xs[0], xs[-1])
		(min_y, max_y) = (ys[0], ys[-1])
		if sum((1 for (x, y) in vertices if min_x <= x <= max_x and min_y <= y <= max_y)) >= K:
			s = (max_x - min_x) * (max_y - min_y)
			if result > s:
				result = s
	print(result)
solve()


(n, k) = map(int, input().split())
ps = [tuple(map(int, input().split())) for i in range(n)]
sx = sorted(ps)
nx = list(enumerate(sx))
ans = 5e+18
for (l, (x1, y1)) in nx[:n - k + 1]:
	for (r, (x2, y2)) in nx[l + k - 1:]:
		dx = x2 - x1
		sy = sorted((y for (x, y) in sx[l:r + 1]))
		for (y3, y4) in zip(sy, sy[k - 1:]):
			if y3 <= y1 and y2 <= y4:
				ans = min(ans, dx * (y4 - y3))
print(ans)


(n, k) = map(int, input().split())
(x, y, xy) = ([], [], [])
for _ in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
	xy.append((a, b))
x.sort()
y.sort()
ans = float('inf')
for i in range(n - 1):
	x1 = x[i]
	for j in range(i + 1, n):
		x2 = x[j]
		for l in range(n - 1):
			y1 = y[l]
			for m in range(l + 1, n):
				y2 = y[m]
				cnt = 0
				for o in range(n):
					(x3, y3) = xy[o]
					if x1 <= x3 <= x2 and y1 <= y3 <= y2:
						cnt += 1
				if cnt >= k:
					ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


import itertools
(n, k) = map(int, input().split())
xy = [tuple(map(int, input().split())) for i in range(n)]
ans = float('INF')
for (a, b) in itertools.combinations(xy, 2):
	for (c, d) in itertools.combinations(xy, 2):
		(x1, x2) = sorted([a[0], b[0]])
		(y1, y2) = sorted([c[1], d[1]])
		count = 0
		for (x, y) in xy:
			if x1 <= x <= x2 and y1 <= y <= y2:
				count += 1
		if count >= k:
			ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


(n, k) = map(int, input().split())
p = []
for i in range(n):
	(x, y) = map(int, input().split())
	p.append([x, y])
ret = 10 ** 25
for a in range(n):
	for b in range(a):
		r = max(p[a][0], p[b][0])
		l = min(p[a][0], p[b][0])
		for c in range(n):
			for d in range(c):
				u = min(p[c][1], p[d][1])
				t = max(p[c][1], p[d][1])
				cnt = 0
				for i in range(n):
					if l <= p[i][0] <= r and u <= p[i][1] <= t:
						cnt += 1
				if cnt >= k:
					ret = min(ret, (r - l) * (t - u))
print(ret)


(n, k) = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(n)]
xy.sort()
ans = 10 ** 20
for i in range(n):
	for j in range(i, n):
		xy_tmp = xy[i:j + 1]
		if len(xy_tmp) >= k:
			l1 = xy_tmp[0][0]
			r1 = xy_tmp[-1][0]
			xy_tmp.sort(key=lambda x: x[1])
			for jj in range(len(xy_tmp) - k + 1):
				ans = min(ans, (r1 - l1) * (xy_tmp[k + jj - 1][1] - xy_tmp[jj][1]))
print(ans)


(N, K) = list(map(int, input().split()))
point = [tuple(map(int, input().split())) for i in range(N)]
point.sort(key=lambda x: x[0])
ans = float('inf')
for i in range(1 + N - K):
	for j in range(i + K, N + 1):
		x = point[j - 1][0] - point[i][0]
		now = point[i:j]
		now.sort(key=lambda x: x[1])
		for k in range(j - i - K + 1):
			ans = min(x * (now[k + K - 1][1] - now[k][1]), ans)
print(ans)


(N, K) = list(map(int, input().split()))
point = []
for _ in range(N):
	point.append(list(map(int, input().split())))
point.sort(key=lambda x: x[0])
shin = 10 ** 200
able = N - K
for i in range(able + 1):
	temp_high = point[:N - i]
	for j in range(able + 1 - i):
		temp_low = temp_high[j:]
		for k in range(able + 1 - i - j):
			temp_left = temp_low[:]
			temp_left.sort(key=lambda x: x[1])
			temp_left = temp_left[k:len(temp_left) - (able + 1 - i - j) + k + 1]
			if temp_left:
				ans = temp_left[:]
			elif temp_low:
				ans = temp_low[:]
			else:
				ans = temp_high[:]
			x = []
			y = []
			for item in ans:
				x.append(item[0])
				y.append(item[1])
			num = (max(x) - min(x)) * (max(y) - min(y))
			shin = min(shin, num)
print(shin)


(N, K) = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(N)]
xy.sort()
ans = 10 ** 20
for l in range(N - K + 1):
	for r in range(l + K - 1, N):
		tb = xy[l:r + 1]
		tb.sort(key=lambda x: x[1])
		for b in range(len(tb) - K + 1):
			t = b + K - 1
			ans = min(ans, (xy[r][0] - xy[l][0]) * (tb[t][1] - tb[b][1]))
print(ans)


(n, k) = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(n)]
xy.sort()
ans = float('inf')
for i in range(n):
	for j in range(i + k - 1, n):
		width = xy[j][0] - xy[i][0]
		y = [e for (_, e) in xy[i:j + 1]]
		y.sort()
		for (e1, e2) in zip(y, y[k - 1:]):
			height = e2 - e1
			area = width * height
			ans = min(ans, area)
print(ans)


(N, K) = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort()
(X, Y) = zip(*XY)
r = float('inf')
for x0 in range(N - K + 1):
	for x1 in range(K + x0 - 1, N):
		x = X[x1] - X[x0]
		Y_s = sorted(Y[x0:x1 + 1])
		for y0 in range(len(Y_s) - K + 1):
			y = Y_s[y0 + K - 1] - Y_s[y0]
			r = min(r, x * y)
print(r)


(N, K) = map(int, input().split())
li = [list(map(int, input().split())) for i in range(N)]
xx = [p[0] for p in li]
yy = [p[1] for p in li]
xx.sort()
yy.sort()
Min = (xx[N - 1] - xx[0]) * (yy[N - 1] - yy[0])
for xi in range(N - 1):
	for xj in range(xi + 1, N):
		for yi in range(N - 1):
			for yj in range(yi + 1, N):
				cnt = 0
				for p in li:
					[x, y] = p
					if xx[xi] <= x <= xx[xj] and yy[yi] <= y <= yy[yj]:
						cnt += 1
				if cnt >= K:
					Min = min(Min, (xx[xj] - xx[xi]) * (yy[yj] - yy[yi]))
print(Min)


(N, K) = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(N)]
xy_xmin = sorted(xy, key=lambda x: x[0])
ans = float('INF')
for i in range(N):
	for j in range(i + K - 1, N):
		X = xy_xmin[j][0] - xy_xmin[i][0]
		xy_ymin = sorted(xy_xmin[i:j + 1], key=lambda x: x[1])
		Y = float('INF')
		for k in range(0, j - i - K + 2):
			Y = min(Y, xy_ymin[k + K - 1][1] - xy_ymin[k][1])
		ans = min(ans, X * Y)
print(ans)


(N, K) = map(int, input().split())
(X, Y, XY) = ([], [], [])
for i in range(N):
	(x, y) = map(int, input().split())
	X += [x]
	Y += [y]
	XY += [[x, y]]
ans = float('inf')
for x1 in range(N):
	for x2 in range(x1 + 1, N):
		for y1 in range(N):
			for y2 in range(y1 + 1, N):
				boxed = 0
				for i in range(N):
					if (X[x1] - X[i]) * (X[x2] - X[i]) <= 0 and (Y[y1] - Y[i]) * (Y[y2] - Y[i]) <= 0:
						boxed += 1
				if boxed >= K:
					ans = min(ans, abs(X[x1] - X[x2]) * abs(Y[y1] - Y[y2]))
print(ans)


import sys
import itertools
sr = lambda : sys.stdin.readline().rstrip()
ir = lambda : int(sr())
lr = lambda : list(map(int, sr().split()))
(N, K) = lr()
XY = [lr() for _ in range(N)]
XY.sort()
answer = float('inf')
for (left, right) in itertools.combinations(range(N), 2):
	width = XY[right][0] - XY[left][0]
	pts = sorted(XY[left:right + 1], key=lambda xy: xy[1])
	if len(pts) < K:
		continue
	for D in range(len(pts) - K + 1):
		if D + K - 1 >= len(pts):
			break
		y_max = pts[D + K - 1][1]
		y_min = pts[D][1]
		area = (y_max - y_min) * width
		if area < answer:
			answer = area
print(answer)


(N, K) = map(int, input().split())
xys = []
for i in range(N):
	(x, y) = map(int, input().split())
	xys.append((x, y))
xs = sorted(map(lambda xy: xy[0], xys))
ys = sorted(map(lambda xy: xy[1], xys))
rs = []
for i in range(N):
	for j in range(i + 1, N):
		x1 = xs[i]
		x2 = xs[j]
		for k in range(N):
			for l in range(k + 1, N):
				y1 = ys[k]
				y2 = ys[l]
				n = len([(x, y) for (x, y) in xys if x1 <= x <= x2 and y1 <= y <= y2])
				if n >= K:
					r = (x2 - x1) * (y2 - y1)
					rs.append(r)
r = min(rs)
print(r)


(n, k) = map(int, input().split())
p = [tuple(map(int, input().split())) for i in range(n)]
p.sort()
ans = 4000000000000000000
for i in range(k, n + 1):
	for j in range(n - i + 1):
		x = p[i + j - 1][0] - p[j][0]
		s = [p[a][1] for a in range(j, i + j)]
		s.sort()
		y = 4000000000
		for a in range(i - k + 1):
			y = min(y, s[a + k - 1] - s[a])
		ans = min(ans, x * y)
print(ans)


(N, K) = map(int, input().split())
XY = sorted([tuple(map(int, input().split())) for _ in range(N)])
ans = 10 ** 20
for xl in range(N):
	for xr in range(xl + 1, N):
		Ysub = sorted([y for (x, y) in XY[xl:xr + 1]])
		for i in range(xr - xl - K + 2):
			Yk = Ysub[i:i + K] + [XY[xr][1], XY[xl][1]]
			ans = min(ans, (XY[xr][0] - XY[xl][0]) * (max(Yk) - min(Yk)))
print(ans)


(N, K) = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in range(N)]
x_sort = sorted(XY, key=lambda x: x[0])

def check(l, r, b, t):
	cnt = 0
	for (x, y) in XY:
		if r >= x and x >= l and (t >= y) and (b >= y):
			cnt += 1
	return cnt >= K
ans = 10 ** 20
for i in range(N - K + 1):
	xl = x_sort[i][0]
	for j in range(i + K - 1, N):
		dx = x_sort[j][0] - xl
		points = sorted(x_sort[i:j + 1], key=lambda x: x[1])
		rest = j - i + 1
		for p in range(rest - K + 1):
			yd = points[p][1]
			for q in range(p + K - 1, rest):
				dy = points[q][1] - yd
				ans = min(ans, dx * dy)
print(ans)


import sys

def MI():
	return map(int, sys.stdin.readline().rstrip().split())
(N, K) = MI()
xy = [tuple(MI()) for i in range(N)]
xy.sort()
from operator import itemgetter
ans = 10 ** 19
for i in range(N - 1):
	for j in range(i + 1, N):
		a = xy[j][0] - xy[i][0]
		A = xy[i:j + 1]
		if len(A) >= K:
			A = sorted(A, key=itemgetter(1))
			b = 10 ** 18
			for k in range(len(A) - K + 1):
				b = min(b, A[k + K - 1][1] - A[k][1])
			ans = min(ans, a * b)
print(ans)


import sys
import itertools
sr = lambda : sys.stdin.readline().rstrip()
ir = lambda : int(sr())
lr = lambda : list(map(int, sr().split()))
(N, K) = lr()
XY = [lr() for _ in range(N)]
XY.sort()
answer = float('inf')
for (i, j) in itertools.combinations(list(range(N)), 2):
	xleft = XY[i][0]
	xright = XY[j][0]
	candidate = sorted(XY[i:j + 1], key=lambda xy: xy[1])
	if len(candidate) < K:
		continue
	for s in range(len(candidate) - K + 1):
		yup = candidate[s + K - 1][1]
		ylow = candidate[s][1]
		area = (xright - xleft) * (yup - ylow)
		if area < answer:
			answer = area
print(answer)


(n, k) = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(n)]
XY.sort(key=lambda x: x[0])
XY = [xy + [x] for (x, xy) in enumerate(XY)]
XY.sort(key=lambda x: x[1])
XY = [xy + [y] for (y, xy) in enumerate(XY)]
gr = [[0] * n for _ in range(n)]
for (_, _, i, j) in XY:
	gr[i][j] = 1
rui = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(n):
	for j in range(n):
		rui[i + 1][j + 1] = rui[i + 1][j] + rui[i][j + 1] - rui[i][j] + gr[i][j]
ans = 10 ** 21
for i in range(n - 1):
	for j in range(i + 1, n):
		x = [XY[m][0] for m in [i, j]]
		y = [XY[m][1] for m in [i, j]]
		ii = [XY[m][2] for m in [i, j]]
		jj = [XY[m][3] for m in [i, j]]
		innerPoints = rui[max(ii) + 1][max(jj) + 1] + rui[min(ii)][min(jj)] - rui[min(ii)][max(jj) + 1] - rui[max(ii) + 1][min(jj)]
		if innerPoints >= k:
			area = (max(x) - min(x)) * (max(y) - min(y))
			if area < ans:
				ans = area
if n > 2:
	for i in range(n - 2):
		for j in range(i + 1, n - 1):
			for l in range(j + 1, n):
				x = [XY[m][0] for m in [i, j, l]]
				y = [XY[m][1] for m in [i, j, l]]
				ii = [XY[m][2] for m in [i, j, l]]
				jj = [XY[m][3] for m in [i, j, l]]
				innerPoints = rui[max(ii) + 1][max(jj) + 1] + rui[min(ii)][min(jj)] - rui[min(ii)][max(jj) + 1] - rui[max(ii) + 1][min(jj)]
				if innerPoints >= k:
					area = (max(x) - min(x)) * (max(y) - min(y))
					if area < ans:
						ans = area
if n > 3:
	for i in range(n - 3):
		for j in range(i + 1, n - 2):
			for l in range(j + 1, n - 1):
				for o in range(l + 1, n):
					x = [XY[m][0] for m in [i, j, o, l]]
					y = [XY[m][1] for m in [i, j, o, l]]
					ii = [XY[m][2] for m in [i, j, o, l]]
					jj = [XY[m][3] for m in [i, j, o, l]]
					innerPoints = rui[max(ii) + 1][max(jj) + 1] + rui[min(ii)][min(jj)] - rui[min(ii)][max(jj) + 1] - rui[max(ii) + 1][min(jj)]
					if innerPoints >= k:
						area = (max(x) - min(x)) * (max(y) - min(y))
						if area < ans:
							ans = area
print(ans)


(n, k) = map(int, input().split())
xy = sorted([tuple(map(int, input().split())) for i in range(n)])
ans = float('INF')
en = tuple(enumerate(xy))
for (i, (a, b)) in en[:n - k + 1]:
	for (j, (c, d)) in en[i + k - 1:]:
		r = sorted((y for (x, y) in xy[i:j + 1]))
		r2 = r[k - 1:]
		for (i2, j2) in zip(r, r2):
			if i2 <= b and d <= j2:
				ans = min(ans, (c - a) * (j2 - i2))
print(ans)


(N, K) = map(int, input().split())
xy = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: (x[0], x[1]))
ans = 10 ** 20
for i in range(K, N + 1):
	for j in range(0, N - i + 1):
		xy2 = sorted(xy[j:j + i], key=lambda x: x[1])
		for k in range(0, i - K + 1):
			xy3 = xy2[k:k + K]
			Y_wid = xy3[-1][1] - xy3[0][1]
			x3 = [tmp for (tmp, _) in xy3]
			X_wid = max(x3) - min(x3)
			ans = min(ans, X_wid * Y_wid)
print(ans)


(n, k) = map(int, input().split())
z = [list(map(int, input().split())) for _ in range(n)]
z.sort()
a = 10 ** 20
for i in range(n):
	for j in range(i + 1, n):
		x = z[j][0] - z[i][0]
		l = sorted((t[1] for t in z[i:j + 1]))
		for (u, v) in zip(l, l[k - 1:]):
			a = min(a, x * (v - u))
print(a)


import sys
input = sys.stdin.readline
import itertools
(n, k) = map(int, input().split())
(X, Y, XY) = ([0] * n, [0] * n, [0] * n)
for i in range(n):
	(x, y) = map(int, input().split())
	(X[i], Y[i], XY[i]) = (x, y, [x, y])
X.sort()
Y.sort()

def count(x1, x2, y1, y2):
	ct = 0
	for (x, y) in XY:
		if x1 <= x <= x2 and y1 <= y <= y2:
			ct += 1
	return ct
ans = float('inf')
for (x1, x2) in itertools.combinations(X, 2):
	for (y1, y2) in itertools.combinations(Y, 2):
		if count(x1, x2, y1, y2) == k:
			ans = min(ans, abs((x1 - x2) * (y1 - y2)))
print(ans)


(N, K) = map(int, input().split())
S = []
T = []
A = []
for i in range(N):
	(x, y) = map(int, input().split())
	S.append(x)
	T.append(y)
	A.append([x, y])
S.sort()
T.sort()
ans = float('inf')
for i in range(N):
	for j in range(i + 1, N):
		for k in range(N):
			for l in range(k + 1, N):
				c = 0
				for (x, y) in A:
					if S[i] <= x <= S[j]:
						if T[k] <= y <= T[l]:
							c += 1
				if c >= K:
					ans = min(ans, (S[j] - S[i]) * (T[l] - T[k]))
print(ans)


import itertools
(n, k) = map(int, input().split())
z = [list(map(int, input().split())) for i in range(n)]
a = [i for i in range(n)]
c = list(itertools.combinations(a, 2))
ans = float('inf')
for x in c:
	for y in c:
		d = 0
		x1 = max(z[x[0]][0], z[x[1]][0])
		x2 = min(z[x[0]][0], z[x[1]][0])
		y1 = max(z[y[0]][1], z[y[1]][1])
		y2 = min(z[y[0]][1], z[y[1]][1])
		for i in range(n):
			if x2 <= z[i][0] <= x1 and y2 <= z[i][1] <= y1:
				d += 1
		if d == k:
			ans = min(ans, (x1 - x2) * (y1 - y2))
print(ans)


(n, k) = list(map(int, input().split()))
ps = [tuple(map(int, input().split())) for i in range(n)]
sx = sorted(ps, key=lambda x: x[0])
nx = list(enumerate(sx))
ans = 5e+18
for (f, (x1, y1)) in nx[:n - k + 1]:
	for (e, (x2, y2)) in nx[f + k - 1:]:
		dx = x2 - x1
		sy = sorted((y for (x, y) in sx[f:e + 1]))
		for (y3, y4) in zip(sy, sy[k - 1:]):
			if y3 <= y1 and y4 >= y2:
				ans = min(ans, dx * (y4 - y3))
print(ans)


(n, k) = map(int, input().split())
dot = []
xxx = []
yyy = []
ans = float('inf')
for i in range(n):
	(x, y) = map(int, input().split())
	dot.append([x, y])
	xxx.append(x)
	yyy.append(y)
xxx.sort()
yyy.sort()
for sx in range(n):
	for sy in range(n):
		for gx in range(sx + 1, n):
			for gy in range(sy + 1, n):
				cnt = 0
				for lst in dot:
					if xxx[sx] <= lst[0] <= xxx[gx]:
						if yyy[sy] <= lst[1] <= yyy[gy]:
							cnt += 1
				if cnt >= k:
					if xxx[sx] == xxx[gx] or yyy[sy] == yyy[gy]:
						continue
					ans = min(ans, (xxx[gx] - xxx[sx]) * (yyy[gy] - yyy[sy]))
print(ans)


from itertools import accumulate
(n, k) = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(n)]
(X, Y) = zip(*XY)

def compress(arr):
	(*XS,) = set(arr)
	XS.sort()
	return {e: i + 1 for (i, e) in enumerate(XS)}
Xlabel = compress(X)
Ylabel = compress(Y)
rX = {j: i for (i, j) in Xlabel.items()}
rY = {j: i for (i, j) in Ylabel.items()}
lX = len(Xlabel)
lY = len(Ylabel)
F = [[0] * (lX + 1) for _ in range(lY + 1)]
for (x, y) in XY:
	F[Ylabel[y]][Xlabel[x]] = 1
for i in range(lY):
	F[i + 1] = list(accumulate(F[i + 1]))
F = list(zip(*F))
for j in range(lY):
	F[j + 1] = list(accumulate(F[j + 1]))
F = list(zip(*F))
ans = float('inf')
for y1 in range(lY):
	for y2 in range(y1 + 1, lY + 1):
		for x1 in range(lX):
			for x2 in range(x1 + 1, lX + 1):
				count = F[y2][x2] - F[y1][x2] - F[y2][x1] + F[y1][x1]
				if count >= k:
					temp = (rX[x2] - rX[x1 + 1]) * (rY[y2] - rY[y1 + 1])
					ans = min(ans, temp)
print(ans)


(N, K) = map(int, input().split())
p = sorted([[int(_) for _ in input().split()] for i in range(N)])
a = 10 ** 20
for xi in range(N - K + 1):
	for xj in range(xi + K - 1, N):
		q = sorted((y for (x, y) in p[xi:xj + 1]))
		for (yi, yj) in zip(q, q[K - 1:]):
			if yi <= p[xi][1] and p[xj][1] <= yj:
				a = min(a, (p[xi][0] - p[xj][0]) * (yi - yj))
print(a)


(N, K) = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort()
(X, Y) = zip(*XY)
r = 10 ** 20
for x0 in range(N - K + 1):
	for x1 in range(K + x0 - 1, N):
		Ys = sorted(Y[x0:x1 + 1])
		for y0 in range(len(Ys) - K + 1):
			r = min(r, (X[x1] - X[x0]) * (Ys[y0 + K - 1] - Ys[y0]))
print(r)


(N, K) = map(int, input().split())
p = [list(map(int, input().split())) for i in range(N)]
(t, b, l, r) = (0, 0, 0, 0)
area = []
for i in range(N):
	t = p[i][1]
	p1 = [a for a in p if a[1] <= t]
	for j in range(len(p1)):
		b = p1[j][1]
		p2 = [a for a in p1 if a[1] >= b]
		for k in range(len(p2)):
			r = p2[k][0]
			p3 = [a for a in p2 if a[0] <= r]
			for m in range(len(p3)):
				l = p3[m][0]
				p4 = [a for a in p3 if a[0] >= l]
				if len(p4) >= K:
					tmp = (l - r) * (t - b)
					area.append(abs(tmp))
print(min(area))


from itertools import combinations
(n, k) = map(int, input().split())
xy = []
xx = []
yy = []
for _ in range(n):
	(x, y) = map(int, input().split())
	xy.append((x, y))
	xx.append(x)
	yy.append(y)
xx.sort()
yy.sort()
ans = 10 ** 20
for (x1, x2) in combinations(xx, 2):
	for (y1, y2) in combinations(yy, 2):
		tmp = 0
		for (x, y) in xy:
			if x1 <= x <= x2 and y1 <= y <= y2:
				tmp += 1
		if tmp < k:
			continue
		ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


(N, K) = (int(x) for x in input().split())
Plot = [tuple((int(x) for x in input().split())) for _ in range(N)]
X = [p[0] for p in Plot]
Y = [p[1] for p in Plot]
X.sort()
Y.sort()
ans = 1e+21
from itertools import combinations
for (x1, x2) in combinations(X, 2):
	for y1 in Y:
		y2 = [y for (x, y) in Plot if x1 <= x <= x2 and y1 <= y]
		if len(y2) < K:
			break
		y2.sort()
		S = (x2 - x1) * (y2[K - 1] - y1)
		ans = min(ans, S)
print(ans)


(N, K) = map(int, input().split())
L = [tuple(map(int, input().split())) for i in range(N)]
L.sort()
ans = 10 ** 37
for i in range(N):
	for j in range(i + 1, N):
		t = L[j][0] - L[i][0]
		S = sorted((x[1] for x in L[i:j + 1]))
		for k in range(len(S) - K + 1):
			u = S[K + k - 1] - S[k]
			ans = min(ans, u * t)
print(ans)


from itertools import combinations
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
(n, k) = map(int, input().split())
x = [0] * n
y = [0] * n
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
xc = list(combinations(x, 2))
yc = list(combinations(y, 2))
ans = 4 * 10 ** 18
for yy in yc:
	u = max(yy)
	d = min(yy)
	for xx in xc:
		r = max(xx)
		l = min(xx)
		count = 0
		for i in range(n):
			if l <= x[i] <= r and d <= y[i] <= u:
				count += 1
		if count >= k:
			ans = min(ans, (u - d) * (r - l))
print(ans)


(n, k) = map(int, input().split())
xy = []
for i in range(n):
	tmp = [int(j) for j in input().split()]
	xy.append((tmp[0], tmp[1]))
from operator import itemgetter
xy.sort(key=itemgetter(1))
xy.sort(key=itemgetter(0))
xy = tuple(xy)
l = tuple(enumerate(xy))
ans = 10 ** 100
for (i, (a, b)) in l[:n - k + 1]:
	for (j, (c, d)) in l[i + k - 1:]:
		l1 = sorted((y for (x, y) in xy[i:j + 1]))
		l2 = l1[k - 1:]
		for (p, q) in zip(l1, l2):
			if p <= b and q >= d:
				ans = min(ans, (c - a) * (q - p))
print(ans)


(N, K) = map(int, input().split())
X = []
Y = []
for _ in range(N):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
Xs = sorted(X)
Ys = sorted(Y)
ans = float('inf')
for left in range(N - 1):
	for right in range(left + 1, N):
		for down in range(N - 1):
			for up in range(down + 1, N):
				count = 0
				for i in range(N):
					if Xs[left] <= X[i] <= Xs[right] and Ys[down] <= Y[i] <= Ys[up]:
						count += 1
				if count >= K:
					ans = min(ans, (Xs[right] - Xs[left]) * (Ys[up] - Ys[down]))
print(ans)


from collections import defaultdict

def main():
	(n, k) = list(map(int, input().split()))
	xy = [list(map(int, input().split())) for _ in range(n)]
	x = [p[0] for p in xy]
	y = [p[1] for p in xy]
	x.sort()
	y.sort()
	s1 = [[0] * n for _ in range(n)]
	s2 = [[0] * n for _ in range(n)]
	s3 = [[0] * n for _ in range(n)]
	s4 = [[0] * n for _ in range(n)]
	for i in range(n):
		for j in range(n):
			for p in xy:
				if p[0] <= x[i] and p[1] <= y[j]:
					s1[i][j] += 1
					s2[i][j] += p[0] < x[i]
					s3[i][j] += p[1] < y[j]
					s4[i][j] += (p[0] < x[i]) * (p[1] < y[j])
	ans = float('inf')
	for s in range(n):
		for t in range(s + 1, n):
			for u in range(n):
				for v in range(u + 1, n):
					if s1[t][v] - s3[t][u] - s2[s][v] + s4[s][u] >= k:
						ans = min(ans, (x[t] - x[s]) * (y[v] - y[u]))
	print(ans)

def __starting_point():
	main()
__starting_point()


def abc075_d():
	(n, k) = map(int, input().split())
	P = []
	xarr = []
	yarr = []
	for _ in range(n):
		(x, y) = (int(x) for x in input().split())
		P.append((x, y))
		xarr.append(x)
		yarr.append(y)
	xarr.sort()
	yarr.sort()
	ans = 5 * 10 ** 18
	for (s, xi) in enumerate(xarr):
		for xj in xarr[s + 1:]:
			cand = [(x, y) for (x, y) in P if xi <= x and x <= xj]
			for (t, yi) in enumerate(yarr):
				for yj in yarr[t + 1:]:
					cnt = len([y for (x, y) in cand if yi <= y and y <= yj])
					if cnt >= k:
						area = (xj - xi) * (yj - yi)
						ans = min(ans, area)
	print(ans)

def __starting_point():
	abc075_d()
__starting_point()


(N, K) = map(int, input().split())
xy = []
for _ in range(N):
	xy.append(tuple(map(int, input().split())))
xy.sort()
ans = float('inf')
for i in range(N):
	for j in range(i + 1, N):
		x = xy[j][0] - xy[i][0]
		y_list = [xy[1] for xy in xy[i:j + 1]]
		y_list.sort()
		for k in range(len(y_list) - K + 1):
			y = y_list[k + K - 1] - y_list[k]
			tmp = x * y
			if ans > tmp:
				ans = tmp
print(ans)


import itertools
(N, K) = map(int, input().split())
X = []
Y = []
xy = []
for i in range(N):
	(x, y) = map(int, input().split())
	xy.append((x, y))
	X.append(x)
	Y.append(y)
ans = 10 ** 20
x2 = list(itertools.combinations(X, 2))
y2 = list(itertools.combinations(Y, 2))
for (xi, xj) in x2:
	if xj < xi:
		(xi, xj) = (xj, xi)
	for (yi, yj) in y2:
		if yj < yi:
			(yi, yj) = (yj, yi)
		n = 0
		for (x, y) in xy:
			if xi <= x <= xj and yi <= y <= yj:
				n += 1
		if n >= K:
			ans = min(ans, (xj - xi) * (yj - yi))
print(ans)


def da_generate(h, w, a):
	da = [[0] * w for j in range(h)]
	da[0][0] = a[0][0]
	for i in range(1, w):
		da[0][i] = da[0][i - 1] + a[0][i]
	for i in range(1, h):
		cnt_w = 0
		for j in range(w):
			cnt_w += a[i][j]
			da[i][j] = da[i - 1][j] + cnt_w
	return da

def da_calc(da, p, q, x, y):
	if p > x or q > y:
		return 0
	if p == 0 and q == 0:
		return da[x][y]
	if p == 0:
		return da[x][y] - da[x][q - 1]
	if q == 0:
		return da[x][y] - da[p - 1][y]
	return da[x][y] - da[p - 1][y] - da[x][q - 1] + da[p - 1][q - 1]
(n, k) = map(int, input().split())
mototen = []
atuten = []
zax = []
zay = []
for i in range(n):
	(x, y) = map(int, input().split())
	mototen.append((x, y))
	zax.append(x)
	zay.append(y)
zax.sort()
zay.sort()
a = [[0 for i in range(len(zay))] for j in range(len(zax))]
for (x, y) in mototen:
	atx = zax.index(x)
	aty = zay.index(y)
	a[atx][aty] += 1
b = da_generate(len(zax), len(zay), a)
ans = float('inf')
for p in range(len(zax) - 1):
	for q in range(len(zay) - 1):
		for x in range(p + 1, len(zax)):
			for y in range(q + 1, len(zax)):
				kar = da_calc(b, p, q, x, y)
				if kar >= k:
					men = (zax[x] - zax[p]) * (zay[y] - zay[q])
					ans = min(ans, men)
print(ans)


(N, K) = map(int, input().split())
v = []
for i in range(0, N):
	(x, y) = map(int, input().split())
	v.append([x, y])
v.sort()
ans = 10 ** 20
for i in range(0, N - 1):
	for j in range(i + 1, N):
		data = []
		for k in range(i, j + 1):
			(x, y) = v[k]
			data.append(y)
		data.sort()
		if K > len(data):
			continue
		else:
			for k in range(0, len(data) - K + 1):
				w = v[j][0] - v[i][0]
				h = data[k + K - 1] - data[k]
				test = w * h
				if ans > test:
					ans = test
print(ans)


(n, t) = map(int, input().split())
x = []
y = []
m = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
	m.append([a, b])
x.sort()
y.sort()
ans = float('inf')
for i in range(n - 1):
	for j in range(i + 1, n):
		for k in range(n - 1):
			for l in range(k + 1, n):
				count = 0
				for (a, b) in m:
					if x[i] <= a <= x[j] and y[k] <= b <= y[l]:
						count += 1
				if count >= t:
					ans = min(ans, (x[j] - x[i]) * (y[l] - y[k]))
print(ans)


(n, K) = map(int, input().split())
d = [[int(i) for i in input().split()] for _ in range(n)]
x = sorted(d, key=lambda x: x[0])
y = sorted(d, key=lambda x: x[1])
ans = float('inf')
for i in range(n):
	for j in range(i + 1, n):
		for k in range(n):
			cnt = 0
			for l in range(k, n):
				if x[i][0] <= y[l][0] <= x[j][0]:
					cnt += 1
				if cnt == K:
					dx = x[j][0] - x[i][0]
					dy = y[l][1] - y[k][1]
					ans = min(ans, dx * dy)
					break
print(ans)


from sys import stdin

def input():
	return stdin.readline().strip()
(n, k) = map(int, input().split())
xy = []
for _ in range(n):
	(i, j) = map(int, input().split())
	xy.append((i, j))
xy.sort()
ans = float('inf')
for left in range(n - k + 1):
	for right in range(left + k - 1, n):
		choose = sorted(xy[left:right + 1], key=lambda x: x[1])
		for down in range(len(choose) - k + 1):
			area = (xy[right][0] - xy[left][0]) * (choose[down + k - 1][1] - choose[down][1])
			if area < ans:
				ans = area
print(ans)


import sys
input = sys.stdin.readline

def inputs():
	return [int(x) for x in input().split()]
(N, K) = inputs()
xy = [inputs() for _ in range(N)]
xy = sorted(xy, key=lambda x: x[0])
ans = 10 ** 20
for i in range(N - K + 1):
	for j in range(i + K - 1, N):
		xy1 = xy[i:j + 1]
		xy1 = sorted(xy1, key=lambda x: x[1])
		mi = min((xy1[i + K - 1][1] - xy1[i][1] for i in range(len(xy1) - K + 1)))
		ans = min(ans, (xy[j][0] - xy[i][0]) * mi)
print(ans)


(N, K) = map(int, input().split())
XY = []
for i in range(N):
	(x, y) = map(int, input().split())
	XY.append((x, y))
XY.sort()
ans = 10 ** 50
for i in range(N - (K - 1)):
	for j in range(i + (K - 1), N):
		(x, y) = XY[i]
		(x1, y1) = XY[j]
		YX = sorted(XY[i:j + 1], key=lambda x: x[1])
		for k in range(len(YX) - (K - 1)):
			for l in range(k + (K - 1), len(YX)):
				if YX[k][1] <= y and y1 <= YX[l][1]:
					ans = min(ans, (x1 - x) * (YX[l][1] - YX[k][1]))
print(ans)


inf = float('inf')
(N, K) = map(int, input().split())
ans = inf
X = []
Y = []
XY = []
for _ in range(N):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
	XY.append((x, y))
X = sorted(X)
Y = sorted(Y)
for (i, left) in enumerate(X):
	for right in X[i + 1:]:
		for (j, bottom) in enumerate(Y):
			for top in Y[j + 1:]:
				cnt = 0
				for (x, y) in XY:
					if left <= x <= right and bottom <= y <= top:
						cnt += 1
				S = (right - left) * (top - bottom)
				if cnt >= K and S < ans:
					ans = S
print(ans)


import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def TUPLE():
	return tuple(map(int, input().split()))

def ZIP(n):
	return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
(N, K) = MAP()
xy = [LIST() for _ in range(N)]
ans = INF
xy.sort()
for l in range(N - K + 1):
	for r in range(l + K, N + 1):
		y = sorted(xy[l:r], key=lambda x: x[1])
		for i in range(r - l - K + 1):
			sq = (xy[r - 1][0] - xy[l][0]) * (y[i + K - 1][1] - y[i][1])
			ans = min(ans, sq)
print(ans)


(n, k) = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(n)]
XY.sort()
ans = float('inf')
for i in range(n):
	for j in range(i + 1, n):
		x = XY[j][0] - XY[i][0]
		T = sorted((Z[1] for Z in XY[i:j + 1]))
		for (u, v) in zip(T, T[k - 1:]):
			ans = min(ans, x * (v - u))
print(ans)


from itertools import product
(N, K) = map(int, input().split())
(x, y) = ([None] * N, [None] * N)
for i in range(N):
	(x[i], y[i]) = map(int, input().split())
xary = sorted(x)
yary = sorted(y)
ans = float('inf')
for (i, j, k, l) in product(range(N), repeat=4):
	if i >= j or k >= l:
		continue
	(x1, x2) = (xary[i], xary[j])
	(y1, y2) = (yary[k], yary[l])
	cnt = 0
	for (xx, yy) in zip(x, y):
		if x1 <= xx <= x2 and y1 <= yy <= y2:
			cnt += 1
	if cnt >= K:
		s = abs(x1 - x2) * abs(y1 - y2)
		ans = min(ans, s)
print(ans)


from itertools import combinations
(N, K) = map(int, input().split())
o = [tuple(map(int, input().split())) for _ in range(N)]
ans = float('inf')
for (i, j) in combinations(o, 2):
	(x1, y1) = i
	(x2, y2) = j
	(xmax, xmin) = (max(x1, x2), min(x1, x2))
	for (k, l) in combinations(o, 2):
		(x3, y3) = k
		(x4, y4) = l
		(ymax, ymin) = (max(y3, y4), min(y3, y4))
		v = 0
		for m in o:
			(x5, y5) = m
			if xmin <= x5 <= xmax and ymin <= y5 <= ymax:
				v += 1
		if v >= K:
			ans = min(ans, (ymax - ymin) * (xmax - xmin))
print(ans)


(N, K) = map(int, input().split())
x = [None] * N
y = [None] * N
for i in range(N):
	(x[i], y[i]) = map(int, input().split())
ans = 10 ** 20
sx = sorted(x)
sy = sorted(y)
for i in range(N):
	for j in range(i + 1, N):
		for k in range(N):
			for l in range(k + 1, N):
				count = 0
				for m in range(N):
					if sx[i] <= x[m] <= sx[j] and sy[k] <= y[m] <= sy[l]:
						count += 1
				if count >= K:
					ans = min(ans, (sx[j] - sx[i]) * (sy[l] - sy[k]))
print(ans)


(N, K) = map(int, input().split())
p = sorted([list(map(int, input().split())) for _ in range(N)])
(x, y) = zip(*p)
inf = float('inf')
ans = inf
for i in range(N - K + 1):
	for j in range(K + i - 1, N):
		Ys = sorted(y[i:j + 1])
		for k in range(len(Ys) - K + 1):
			ans = min(ans, (x[j] - x[i]) * (Ys[k + K - 1] - Ys[k]))
print(ans)


def main():
	(N, K) = list(map(int, input().split()))
	(x, y) = ([None] * N, [None] * N)
	for i in range(N):
		(x[i], y[i]) = list(map(int, input().split()))
	points = [[i, x[i], y[i]] for i in range(N)]
	points_ysort = sorted(points, key=lambda p: p[2], reverse=True)
	points_ysort_rev = list(reversed(points_ysort))
	points_xsort = sorted(points, key=lambda p: p[1], reverse=False)
	points_xsort_rev = list(reversed(points_xsort))
	min_area = 4 * 10 ** 18
	outsides_top = []
	t = 0
	while t <= N - K:
		(top_i, top_x, top_y) = points_ysort[t]
		outsides_bottom = []
		b = 0
		while b < N:
			(bottom_i, bottom_x, bottom_y) = points_ysort_rev[b]
			if bottom_i == top_i:
				break
			n_outsides_left = 0
			l = 0
			while l < N:
				(left_i, left_x, left_y) = points_xsort[l]
				if left_x > top_x:
					break
				if left_i in outsides_top or left_i in outsides_bottom:
					l += 1
					continue
				n_outsides_right = 0
				r = 0
				while r < N:
					if N - t - b - n_outsides_left - n_outsides_right < K:
						break
					(right_i, right_x, right_y) = points_xsort_rev[r]
					if right_i == left_i:
						break
					if right_x < top_x:
						break
					if right_i in outsides_top or right_i in outsides_bottom:
						r += 1
						continue
					area = (top_y - bottom_y) * (right_x - left_x)
					if area < min_area:
						min_area = area
					n_outsides_right += 1
					r += 1
				n_outsides_left += 1
				l += 1
			outsides_bottom.append(bottom_i)
			b += 1
		outsides_top.append(top_i)
		t += 1
	return min_area
print(main())


(N, K) = map(int, input().split())
point = []
for _ in range(N):
	(x, y) = map(int, input().split())
	point.append((x, y))
ans = float('inf')
for (lx, _) in point:
	for (rx, _) in point:
		if lx > rx:
			continue
		for (_, ly) in point:
			for (_, ry) in point:
				if ly > ry:
					continue
				count = 0
				for (x, y) in point:
					if lx <= x <= rx and ly <= y <= ry:
						count += 1
				if count >= K:
					ans = min(ans, (rx - lx) * (ry - ly))
print(ans)


def i1():
	return int(input())

def i2():
	return [int(i) for i in input().split()]
[n, k] = i2()
x = []
y = []
zz = []
for i in range(n):
	z = i2()
	x.append([z[0], i])
	y.append([z[1], i])
	zz.append(z)
x.sort()
y.sort()
xx = [i[1] for i in x]
yy = [i[1] for i in y]
a = float('inf')
for i in range(n):
	for j in range(i, n):
		for kk in range(n):
			for l in range(kk, n):
				if len(set(xx[i:j + 1]) & set(yy[kk:l + 1])) == k:
					a = min(a, (zz[xx[j]][0] - zz[xx[i]][0]) * (zz[yy[l]][1] - zz[yy[kk]][1]))
print(a)


(N, K) = map(int, input().split())
XY = [[0, 0, 0] for _ in range(N)]
for i in range(N):
	(x, y) = map(int, input().split())
	XY[i] = [x, y, i]
X = sorted(XY)
Y = sorted(XY, key=lambda x: x[1])
rect = (X[-1][0] - X[0][0]) * (Y[-1][1] - Y[0][1])
for l in range(N - K + 1):
	for r in range(l + K - 1, N):
		for d in range(N - K + 1):
			for u in range(d + K - 1, N):
				if len([x for x in XY if X[l][0] <= x[0] <= X[r][0] and Y[d][1] <= x[1] <= Y[u][1]]) >= K:
					rect = min((X[r][0] - X[l][0]) * (Y[u][1] - Y[d][1]), rect)
print(rect)


(n, k) = map(int, input().split())
li = sorted([list(map(int, input().split())) for i in range(n)], key=lambda x: (x[1], x[0]))
ans = float('INF')
for i in range(n):
	for j in range(i + 1, n):
		(ux, lx) = (max(li[i][0], li[j][0]), min(li[i][0], li[j][0]))
		(l, r) = (0, 0)
		cnt = int(lx <= li[r][0] <= ux)
		while True:
			while r < n - 1 and cnt < k:
				r += 1
				cnt += int(lx <= li[r][0] <= ux)
			if cnt < k or not 0 <= r <= n - 1 or (not 0 <= l <= n - 1) or (r <= l):
				break
			if ans > (ux - lx) * (li[r][1] - li[l][1]):
				ans = (ux - lx) * (li[r][1] - li[l][1])
			cnt -= int(lx <= li[l][0] <= ux)
			l += 1
print(ans)


import sys
import math
import collections
import bisect
import itertools
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
ni = lambda : int(sys.stdin.readline().rstrip())
ns = lambda : list(map(int, sys.stdin.readline().rstrip().split()))
na = lambda : list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda : list([int(x) - 1 for x in sys.stdin.readline().rstrip().split()])

def main():
	(n, k) = ns()
	pos = []
	for _ in range(n):
		(x, y) = ns()
		pos.append((x, y))
	ans = INF
	for tmp in itertools.combinations_with_replacement(pos, 4):
		xl = max(tmp, key=lambda t: t[0])[0]
		xs = min(tmp, key=lambda t: t[0])[0]
		yl = max(tmp, key=lambda t: t[1])[1]
		ys = min(tmp, key=lambda t: t[1])[1]
		cnt = 0
		for (xi, yi) in pos:
			if xs <= xi <= xl and ys <= yi <= yl:
				cnt += 1
		if cnt >= k:
			ans = min(ans, (xl - xs) * (yl - ys))
	print(ans)

def __starting_point():
	main()
__starting_point()


def main():
	(N, K) = list(map(int, input().split(' ')))
	points = [list(map(int, input().split(' '))) for _ in range(N)]
	points.sort(key=lambda p: p[1])
	ans = 10 ** 19
	for b in range(N):
		bottom = points[b][1]
		for t in range(b + K - 1, N):
			top = points[t][1]
			target_points = points[b:t + 1].copy()
			target_points.sort(key=lambda p: p[0])
			M = len(target_points)
			for left in range(M):
				right = left + K - 1
				if right >= M:
					break
				width = target_points[right][0] - target_points[left][0]
				ans = min([ans, width * (top - bottom)])
	print(ans)

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
pos = []
for i in range(n):
	(x, y) = map(int, input().split())
	pos.append((x, y))
pos.sort()
minSq = 4000000000000000000
for l in range(n):
	(lx, ly) = pos[l]
	que = []
	for r in range(l, n):
		(rx, ry) = pos[r]
		que.append(ry)
		sizes = sorted(que)
		n_sizes = len(que)
		if n_sizes < k:
			continue
		for i_top in range(k - 1, n_sizes):
			top = sizes[i_top]
			bottom = sizes[i_top - k + 1]
			minSq = min(minSq, (top - bottom) * (rx - lx))
print(minSq)


from itertools import combinations

def main():
	(N, K) = map(int, input().split())
	P = [list(map(int, input().split())) for _ in range(N)]
	ans = 1 << 62
	for t in combinations(P, min(4, K)):
		(xs, ys) = zip(*t)
		xmin = min(xs)
		xmax = max(xs)
		ymin = min(ys)
		ymax = max(ys)
		area = (xmax - xmin) * (ymax - ymin)
		if ans < area:
			continue
		k = 0
		for (x, y) in P:
			if xmin <= x <= xmax and ymin <= y <= ymax:
				k += 1
		if k >= K:
			ans = area
	print(ans)
main()


import sys

def input():
	return sys.stdin.readline().strip()

def mapint():
	return map(int, input().split())
sys.setrecursionlimit(10 ** 9)
(N, K) = mapint()
XY = [list(mapint()) for _ in range(N)]
from itertools import combinations_with_replacement as cwr
ans = 10 ** 20
for (p1, p2, p3, p4) in cwr(XY, 4):
	(x1, y1) = p1
	(x2, y2) = p2
	(x3, y3) = p3
	(x4, y4) = p4
	(lx, rx) = (min(x1, x2, x3, x4), max(x1, x2, x3, x4))
	(ly, ry) = (min(y1, y2, y3, y4), max(y1, y2, y3, y4))
	cnt = 0
	for (x, y) in XY:
		if lx <= x <= rx and ly <= y <= ry:
			cnt += 1
	if cnt >= K:
		ans = min(ans, (rx - lx) * (ry - ly))
print(ans)


(N, K) = map(int, input().split())
p = []
for i in range(N):
	(a, b) = map(int, input().split())
	p.append((a, b))
sx = sorted(p)
ans = 10 ** 50
for (x1, y1) in sx:
	for (x2, y2) in sx:
		if x2 <= x1:
			continue
		l = sx.index((x1, y1))
		r = sx.index((x2, y2))
		if r - l + 1 < K:
			continue
		sy = sorted(sx[l:r + 1], key=lambda coor: coor[1])
		for j in range(len(sy) - K + 1):
			if sy[j][1] <= y1 and y2 <= sy[j + K - 1][1]:
				ans = min(ans, (x2 - x1) * (sy[j + K - 1][1] - sy[j][1]))
print(ans)


from itertools import combinations
(N, K) = map(int, input().split())
XY = [tuple(map(int, input().split())) for _ in range(N)]
ans = 10 ** 20
for rect in combinations(XY, r=min(K, 4)):
	X = [x for (x, _) in rect]
	Y = [y for (_, y) in rect]
	(miX, mxX) = (min(X), max(X))
	(miY, mxY) = (min(Y), max(Y))
	cnt = len([x for (x, y) in XY if miY <= y <= mxY and miX <= x <= mxX])
	if cnt >= K:
		ans = min(ans, (mxX - miX) * (mxY - miY))
print(ans)


from sys import stdin

def main():
	readline = stdin.readline
	inf = 10 ** 20
	(n, k) = map(int, readline().split())
	co = [list(map(int, readline().split())) for _ in range(n)]
	co.sort()
	x_range = []
	for i in range(n - 1):
		for j in range(i + 1, n):
			x_range.append((co[i][0], co[j][0]))
	co.sort(key=lambda x: x[1])
	ans = inf
	for x in x_range:
		x_min = x[0]
		x_max = x[1]
		y_min = 0
		y_max = 0
		for under in range(n):
			cnt = 0
			for i in range(under, n):
				if x_min <= co[i][0] <= x_max:
					if cnt == 0:
						y_min = co[i][1]
						cnt += 1
					else:
						y_max = co[i][1]
						cnt += 1
				if cnt == k:
					break
			if cnt == k:
				ans = min(ans, (x_max - x_min) * (y_max - y_min))
	print(ans)

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
p = sorted([tuple(map(int, input().split())) for i in range(n)])
ans = 4 * 10 ** 18
for i in range(k, n + 1):
	for j in range(n - i + 1):
		x = p[i + j - 1][0] - p[j][0]
		s = sorted([p[a][1] for a in range(j, i + j)])
		y = min((s[a + k - 1] - s[a] for a in range(i - k + 1)))
		ans = min(ans, x * y)
print(ans)


(n, k) = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(n)]
x = [t[0] for t in xy]
y = [t[1] for t in xy]
res = []
for i in range(n - 1):
	for j in range(i + 1, n):
		for a in range(n - 1):
			for b in range(a + 1, n):
				l = min(x[i], x[j])
				r = max(x[i], x[j])
				d = min(y[a], y[b])
				u = max(y[a], y[b])
				tk = 0
				for t in xy:
					if l <= t[0] <= r and d <= t[1] <= u:
						tk += 1
				if tk >= k:
					res.append((r - l) * (u - d))
print(min(res))


(N, K) = map(int, input().split())
p = [[int(x) for x in input().split()] for _ in range(N)]
xs = [x for (x, _) in p]
ys = [y for (_, y) in p]
q = [(x, y) for x in xs for y in ys]
up = [set() for _ in range(len(q))]
dn = [set() for _ in range(len(q))]
for i in range(len(q)):
	(xi, yi) = q[i]
	for j in range(len(p)):
		(xj, yj) = p[j]
		if xj >= xi and yj >= yi:
			up[i].add(j)
		if xj <= xi and yj <= yi:
			dn[i].add(j)
ans = 10 ** 999
for i in range(len(q)):
	for j in range(len(q)):
		if len(up[i] & dn[j]) >= K:
			(xi, yi) = q[i]
			(xj, yj) = q[j]
			ans = min(ans, abs(xj - xi) * abs(yj - yi))
print(ans)


import itertools
(n, k) = map(int, input().split())
p = []
vy = set()
vx = set()
for i in range(n):
	(x, y) = map(int, input().split())
	p.append((y, x))
	vy.add(y)
	vx.add(x)
vy = sorted(list(vy))
vx = sorted(list(vx))
min_area = float('inf')
for y in itertools.combinations(vy, r=2):
	for x in itertools.combinations(vx, r=2):
		cnt = 0
		for i in range(n):
			if y[0] <= p[i][0] <= y[1] and x[0] <= p[i][1] <= x[1]:
				cnt += 1
		if cnt >= k:
			min_area = min(min_area, (y[1] - y[0]) * (x[1] - x[0]))
print(min_area)


inf = float('inf')
(N, K) = map(int, input().split())
ans = inf
X = []
Y = []
XY = []
for _ in range(N):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
	XY.append((x, y))
X = sorted(X)
Y = sorted(Y)
for i in range(N):
	for j in range(i + 1, N):
		for k in range(N):
			for l in range(k + 1, N):
				cnt = 0
				for (x, y) in XY:
					if X[i] <= x <= X[j] and Y[k] <= y <= Y[l]:
						cnt += 1
				if cnt < K:
					continue
				S = (Y[l] - Y[k]) * (X[j] - X[i])
				if S < ans:
					ans = S
print(ans)


(n, k) = [int(x) for x in input().split()]
x = [0] * n
y = [0] * n
for i in range(n):
	(x[i], y[i]) = [int(x) for x in input().split()]
from itertools import product
ans = float('inf')
for (xmax, xmin, ymax, ymin) in product(x, x, y, y):
	if xmax <= xmin or ymax <= ymin or (xmax - xmin) * (ymax - ymin) >= ans:
		continue
	if len([0 for (xi, yi) in zip(x, y) if xmin <= xi <= xmax and ymin <= yi <= ymax]) >= k:
		ans = (xmax - xmin) * (ymax - ymin)
print(ans)


(N, K) = map(int, input().split())
xy = []
X = []
Y = []
for i in range(N):
	(x, y) = map(int, input().split())
	xy.append([x, y])
xy.sort()
X = [i[0] for i in xy]
Y = [i[1] for i in xy]
ans = 10 ** 30
for i in range(K, N + 1):
	for j in range(N + 1 - i):
		X_ = X[j:j + i]
		Y_ = Y[j:j + i]
		Y_.sort()
		a = max(X_) - min(X_)
		for k in range(i - K + 1):
			z = Y_[k:k + K]
			b = max(z) - min(z)
			ans = min(ans, a * b)
print(ans)


from itertools import combinations
(N, K) = map(int, input().split())
xs = set()
ys = set()
inl = []
for i in range(N):
	(x, y) = map(int, input().split())
	inl.append((x, y))
	xs.add(x)
	ys.add(y)
xs = list(xs)
ys = list(ys)
xs.sort()
ys.sort()
res = 9223372036854775807
for (xlow, xhi) in combinations(xs, 2):
	for (ylow, yhi) in combinations(ys, 2):
		cnt = 0
		for (x, y) in inl:
			cnt += x >= xlow and x <= xhi and (y >= ylow) and (y <= yhi)
		if cnt == K:
			res = min(res, (xhi - xlow) * (yhi - ylow))
print(res)


(n, K) = map(int, input().split())
(X, Y) = ([], [])
dots = []
for _ in range(n):
	(x, y) = map(int, input().split())
	dots.append((x, y))
	X.append(x)
	Y.append(y)
X.sort()
Y.sort()
ans = float('inf')
for i in range(n):
	for j in range(i + 1, n):
		for k in range(n):
			for l in range(k + 1, n):
				(x1, x2) = (X[i], X[j])
				(y1, y2) = (Y[k], Y[l])
				cnt = 0
				for dot in dots:
					if x1 <= dot[0] <= x2 and y1 <= dot[1] <= y2:
						cnt += 1
				if cnt >= K:
					ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


(N, K) = map(int, input().split())
P = [tuple(map(int, input().split())) for _ in range(N)]
P.sort()
ans = float('inf')
for i in range(N - K + 1):
	for j in range(i + K - 1, N):
		x = P[j][0] - P[i][0]
		if x == 0:
			continue
		Q = P[i:j + 1]
		Q.sort(key=lambda q: q[1])
		y = Q[-1][1] - Q[0][1]
		for k in range(0, len(Q) - K + 1):
			for l in range(k + K - 1, len(Q)):
				ny = Q[l][1] - Q[k][1]
				if ny == 0:
					continue
				y = min(y, ny)
		ans = min(ans, x * y)
print(ans)


(N, K) = map(int, input().split())
(X, Y) = ([], [])
D = []
for i in range(N):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
	D.append((x, y))
X = sorted(X)
Y = sorted(Y)
num = float('inf')
for i in range(N - 1):
	for j in range(i + 1, N):
		for k in range(N - 1):
			for l in range(k + 1, N):
				tmp = 0
				for m in range(N):
					if X[i] <= D[m][0] <= X[j] and Y[k] <= D[m][1] <= Y[l]:
						tmp += 1
				if tmp >= K:
					num = min(num, (X[j] - X[i]) * (Y[l] - Y[k]))
print(num)


def main():
	(N, K) = list(map(int, input().split()))
	XY = [tuple(map(int, input().split())) for _ in range(N)]
	XY.sort()
	XY = tuple(XY)

	def count(x_min, x_max, y_min, y_max, i, j):
		OK = 0
		for (m, n) in XY[i:j + 1]:
			if y_min <= n <= y_max:
				OK += 1
		if OK >= K:
			return True
		return False
	ans = 10 ** 20
	for (i, val_i) in enumerate(XY[:N - 1]):
		a = val_i[0]
		for j in range(i + K - 1, N):
			b = XY[j][0]
			e = b - a
			for (k, c) in XY:
				for (l, d) in XY:
					if c < d:
						if e * (d - c) < ans and count(a, b, c, d, i, j):
							ans = e * (d - c)
	print(ans)
	return

def __starting_point():
	main()
__starting_point()


(N, K) = map(int, input().split())
x = [0] * N
y = [0] * N
z = [0] * N
for i in range(N):
	(x[i], y[i]) = map(int, input().split())
	z[i] = (x[i], y[i])
ans = float('inf')
for s in x:
	for t in x:
		for u in y:
			for v in y:
				cnt = 0
				for zz in z:
					if s <= zz[0] <= t and u <= zz[1] <= v:
						cnt += 1
				if cnt >= K:
					tmp = (t - s) * (v - u)
					ans = min(ans, tmp)
print(ans)


from itertools import combinations
(N, K) = map(int, input().split())
points = []
X = []
Y = []
for _ in range(N):
	(x, y) = map(int, input().split())
	points.append((x, y))
	X.append(x)
	Y.append(y)
X.sort()
Y.sort()
ans = float('inf')
for (x1, x2) in combinations(X, 2):
	for (y1, y2) in combinations(Y, 2):
		cnt = 0
		for point in points:
			if x1 <= point[0] <= x2 and y1 <= point[1] <= y2:
				cnt += 1
		if cnt >= K:
			ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


from itertools import combinations
(n, k) = (int(x) for x in input().split())
XY = [tuple((int(x) for x in input().split())) for _ in range(n)]
ans = 10 ** 20
X = []
Y = []
for (x, y) in XY:
	X.append(x)
	Y.append(y)
ans = 10 ** 20
for (ax, bx) in combinations(X, 2):
	if ax > bx:
		(ax, bx) = (bx, ax)
	for (ay, by) in combinations(Y, 2):
		if ay > by:
			(ay, by) = (by, ay)
		count = 0
		for (x, y) in XY:
			if ax <= x <= bx and ay <= y <= by:
				count += 1
		if count >= k:
			ans = min(ans, (bx - ax) * (by - ay))
print(ans)


from collections import deque
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	(n, k) = MI()
	xx = set()
	yy = set()
	xy = []
	for _ in range(n):
		(x, y) = MI()
		xy.append((x, y))
		xx.add(x)
		yy.add(y)
	xy.sort()
	xx = list(sorted(xx))
	yy = list(sorted(yy))
	xn = len(xx)
	yn = len(yy)
	ans = 10 ** 20
	for t in range(yn):
		y2 = yy[t]
		for b in range(t):
			y1 = yy[b]
			r = -1
			s = 0
			i = j = 0
			for (l, x1) in enumerate(xx):
				while i < n and xy[i][0] < x1:
					if y1 <= xy[i][1] <= y2:
						s -= 1
					i += 1
				while s < k and r + 1 < xn:
					r += 1
					x2 = xx[r]
					while j < n and xy[j][0] <= x2:
						if y1 <= xy[j][1] <= y2:
							s += 1
						j += 1
				if s >= k:
					cur = (x2 - x1) * (y2 - y1)
					if cur < ans:
						ans = cur
	print(ans)
main()


from itertools import combinations
(N, K) = map(int, input().split())
P = [tuple(map(int, input().split())) for _ in range(N)]
ans = 10 ** 18 * 5
for x in combinations(range(N), 2):
	u = max(P[x[0]][0], P[x[1]][0])
	d = min(P[x[0]][0], P[x[1]][0])
	for y in combinations(range(N), 2):
		r = max(P[y[0]][1], P[y[1]][1])
		l = min(P[y[0]][1], P[y[1]][1])
		count = 0
		for i in range(N):
			if d <= P[i][0] <= u and l <= P[i][1] <= r:
				count += 1
		if count >= K:
			ans = min(ans, (u - d) * (r - l))
print(ans)


(N, K) = map(int, input().split())
xy = []
for _ in range(N):
	xy.append(tuple(map(int, input().split())))
(xs, ys) = map(list, zip(*xy))
xs.sort()
ys.sort()
ans = float('inf')
for l in range(N):
	for r in range(l + 1, N):
		for b in range(N):
			for t in range(b + 1, N):
				(xl, xr) = (xs[l], xs[r])
				(yb, yt) = (ys[b], ys[t])
				cnt = 0
				for (xi, yi) in xy:
					if xl <= xi <= xr and yb <= yi <= yt:
						cnt += 1
				if cnt >= K:
					ans = min(ans, (xr - xl) * (yt - yb))
print(ans)


(N, K) = map(int, input().split())
A = [list(map(int, input().split())) for i in range(N)]
(B, C) = zip(*A)
S = 10 ** 36
for left in B:
	for right in B:
		for up in C:
			for down in C:
				if left < right and down < up:
					cnt = 0
					for (x, y) in A:
						if left <= x <= right and down <= y <= up:
							cnt += 1
					if cnt >= K:
						S = min(S, (right - left) * (up - down))
print(S)


(N, K) = map(int, input().split())
(x, y) = ([], [])
p = []
for i in range(N):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
	p.append((a, b))
x.sort()
y.sort()
ans = 10 ** 30
for r in range(N):
	for l in range(r):
		for u in range(N):
			for d in range(u):
				(R, L, U, D) = (x[r], x[l], y[u], y[d])
				cnt = 0
				m = (R - L) * (U - D)
				for i in range(N):
					if p[i][0] >= L and p[i][0] <= R and (p[i][1] >= D) and (p[i][1] <= U):
						cnt += 1
				if cnt >= K:
					ans = min(ans, m)
print(ans)


import sys
sys.setrecursionlimit(10 ** 6)
readline = sys.stdin.readline
(n, k) = [int(i) for i in readline().split()]
xy = [[int(i) for i in readline().split()] for i in range(n)]
xy.sort()
ans = 4 * 10 ** 18 + 10
for i in range(n):
	for j in range(i + k - 1, n):
		dx = xy[j][0] - xy[i][0]
		y = sorted((xy[k][1] for k in range(i, j + 1)))
		L = len(y) - k + 1
		for i in range(L):
			dy = y[i + k - 1] - y[i]
			ans = min(ans, dy * dx)
print(ans)


(N, K) = map(int, input().split())
ary = [list(map(int, input().split())) for _ in range(N)]
a = sorted(ary)
ans = float('Inf')
for i in range(N - K + 1):
	for j in range(i, N - K + 1):
		lx = a[i][0]
		rx = a[K + j - 1][0]
		b = a[i:K + j]
		c = sorted(b, key=lambda x: x[1])
		for k in range(len(c) - K + 1):
			by = c[k][1]
			uy = c[k + K - 1][1]
			ans = min(ans, (rx - lx) * (uy - by))
print(ans)


(n, k) = map(int, input().split())
z = [list(map(int, input().split())) for _ in range(n)]
x = []
y = []
for (i, j) in z:
	x.append(i)
	y.append(j)
x.sort()
y.sort()
a = 10 ** 20
for (i, l) in enumerate(x):
	for r in x[i + 1:]:
		for (v, d) in enumerate(y):
			for u in y[v + 1:]:
				if sum([1 for (i, j) in z if l <= i <= r and d <= j <= u]) >= k:
					a = min(a, (r - l) * (u - d))
print(a)


(N, K) = map(int, input().split())
X = []
Y = []
XY = []
for _ in range(N):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
	XY.append((x, y))
X = sorted(X)
Y = sorted(Y)
mi = 1 << 200
for i in range(N):
	for j in range(i + 1, N):
		for k in range(N):
			for l in range(k + 1, N):
				s = 0
				for (x, y) in XY:
					if X[i] <= x <= X[j] and Y[k] <= y <= Y[l]:
						s += 1
				if s >= K:
					mi = min(mi, (X[j] - X[i]) * (Y[l] - Y[k]))
print(mi)


import sys
from itertools import combinations

def _solve(y1, y2, sorted_points, K):
	(y1, y2) = tuple(sorted([y1, y2]))
	x = tuple((x for (x, y) in sorted_points if y1 <= y <= y2))
	if len(x) < K:
		return float('inf')
	return min(((y2 - y1) * (x2 - x1) for (x1, x2) in zip(x, x[K - 1:])))

def solve(N: int, K: int, x: 'List[int]', y: 'List[int]'):
	sorted_points = tuple(sorted(zip(x, y)))
	return min((_solve(y1, y2, sorted_points, K) for (y1, y2) in combinations(y, 2)))

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	N = int(next(tokens))
	K = int(next(tokens))
	x = [int()] * N
	y = [int()] * N
	for i in range(N):
		x[i] = int(next(tokens))
		y[i] = int(next(tokens))
	print(solve(N, K, x, y))

def __starting_point():
	main()
__starting_point()


(N, K) = map(int, input().split())
XY = [tuple(map(int, input().split())) for _ in range(N)]
Xs = set()
Ys = set()
for (x, y) in XY:
	Xs.add(x)
	Ys.add(y)
Xs = list(Xs)
Xs.sort()
Ys = list(Ys)
Ys.sort()
LX = len(Xs)
LY = len(Ys)
ans = 10 ** 20
for i in range(LX):
	for j in range(i + 1, LX):
		for k in range(LY):
			for l in range(k + 1, LY):
				cnt = 0
				for (x, y) in XY:
					if Xs[i] <= x <= Xs[j] and Ys[k] <= y <= Ys[l]:
						cnt += 1
				if cnt >= K:
					ans = min(ans, (Xs[j] - Xs[i]) * (Ys[l] - Ys[k]))
print(ans)


(n, k) = map(int, input().split())
xy = [tuple(map(int, input().split())) for _ in range(n)]
ans = 10 ** 50
xy.sort()
for l in range(0, n):
	for r in range(l + k - 1, n):
		y = [xy[i][1] for i in range(l, r + 1)]
		y.sort()
		h = 10 ** 50
		for i in range(len(y) - k + 1):
			h = min(h, y[i + k - 1] - y[i])
		ans = min(ans, h * (xy[r][0] - xy[l][0]))
print(ans)


from itertools import combinations
(N, K) = map(int, input().split())
dots = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
ans = 10 ** 37
for i in range(N):
	for j in range(i + K - 1, N):
		width = dots[j][0] - dots[i][0]
		y = sorted([l for (_, l) in dots[i:j + 1]])
		for (a, b) in zip(y, y[K - 1:]):
			height = b - a
			ans = min(ans, width * height)
print(ans)


import sys
input = sys.stdin.readline
INF = 10 ** 20
MOD = 10 ** 9 + 7
from bisect import insort_left

def main():
	(n, k) = map(int, input().split())
	XY = [tuple(map(int, input().split())) for _ in range(n)]
	XY.sort(key=lambda x: x[0])
	ans = INF
	for l in range(n - k + 1):
		Y = [XY[i][1] for i in range(l, l + k - 1)]
		Y.sort()
		dif = -1
		for r in range(l + k - 1, n):
			dif += 1
			insort_left(Y, XY[r][1])
			w = INF
			for i in range(dif + 1):
				w = min(w, Y[i + k - 1] - Y[i])
			ans = min(ans, w * (XY[r][0] - XY[l][0]))
	print(ans)

def __starting_point():
	main()
__starting_point()


import sys
from bisect import bisect_left
input = sys.stdin.readline
(n, k) = list(map(int, input().split()))
p = [list(map(int, input().split())) for _ in range(n)]
x = [p[i][0] for i in range(n)]
x.sort()
y = [p[i][1] for i in range(n)]
y.sort()
coord = [[0] * n for i in range(n)]
for i in range(n):
	x_idx = bisect_left(x, p[i][0])
	y_idx = bisect_left(y, p[i][1])
	coord[x_idx][y_idx] += 1
coord_cs = [[0] * (n + 1) for i in range(n + 1)]
for i in range(n):
	for j in range(n):
		coord_cs[i + 1][j + 1] = coord[i][j]
for i in range(n):
	for j in range(n + 1):
		coord_cs[i + 1][j] += coord_cs[i][j]
for i in range(n + 1):
	for j in range(n):
		coord_cs[i][j + 1] += coord_cs[i][j]
ans = (x[-1] - x[0]) * (y[-1] - y[0])
for xi in range(n):
	for xj in range(xi + 1, n + 1):
		for yi in range(n):
			for yj in range(yi + 1, n + 1):
				if coord_cs[xj][yj] - coord_cs[xi][yj] - coord_cs[xj][yi] + coord_cs[xi][yi] == k:
					cand = (x[xj - 1] - x[xi]) * (y[yj - 1] - y[yi])
					ans = min(ans, cand)
print(ans)


import sys
I = lambda : [int(x) for x in sys.stdin.readline().split()]
(N, K) = I()
Z = [I() for _ in range(N)]
Z.sort()
INF = 10 ** 20
ans = INF
for i in range(N):
	for j in range(i + K - 1, N):
		l = sorted((t[1] for t in Z[i:j + 1]))
		ans_tmp = [(Z[j][0] - Z[i][0]) * (v - u) for (u, v) in zip(l, l[K - 1:])]
		ans = min(ans, *ans_tmp)
print(ans)


(n, k) = map(int, input().split())
X = [0] * n
Y = [0] * n
for i in range(n):
	(X[i], Y[i]) = map(int, input().split())
Xs = sorted(X)
Ys = sorted(Y)
XY = sorted(list(zip(X, Y)))
ans = 1e+100
for i in range(n - k + 1):
	for j in range(i + k - 1, n):
		w = Xs[j] - Xs[i]
		XYs = sorted(XY[i:j + 1], key=lambda x: x[1])
		h = 1e+100
		for l in range(len(XYs) - k + 1):
			h = min(h, XYs[l + k - 1][1] - XYs[l][1])
		ans = min(ans, h * w)
print(ans)


(n, k) = map(int, input().split())
x = [0] * n
y = [0] * n
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
ans = 1e+20
for i in range(n):
	for j in range(i + 1, n):
		for a in range(n):
			for b in range(a + 1, n):
				cnt = 0
				x1 = min(x[i], x[j])
				x2 = max(x[i], x[j])
				y1 = min(y[a], y[b])
				y2 = max(y[a], y[b])
				for c in range(n):
					if x1 <= x[c] <= x2 and y1 <= y[c] <= y2:
						cnt += 1
				if cnt >= k:
					ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


(N, K) = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(N)]
ans = 10 ** 20
xy.sort()
for l in range(N - K + 1):
	for r in range(l + K, N + 1):
		y = sorted(xy[l:r], key=lambda v: v[1])
		for i in range(r - l - K + 1):
			sq = (xy[r - 1][0] - xy[l][0]) * (y[i + K - 1][1] - y[i][1])
			ans = min(ans, sq)
print(ans)


(n, k) = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(n)]

def check(x1, y1, x2, y2):
	cnt = 0
	for node in xy:
		(x, y) = node
		if x1 <= x <= x2 and y1 <= y <= y2:
			cnt += 1
	return cnt
xlis = []
ylis = []
for itm in xy:
	(x, y) = itm
	xlis.append(x)
	ylis.append(y)
xlis.sort()
ylis.sort()
ans = 10 ** 20
from itertools import *
for tmp1 in combinations(xlis, 2):
	for tmp2 in combinations(ylis, 2):
		(x1, x2) = tmp1
		(y1, y2) = tmp2
		ret = check(x1, y1, x2, y2)
		if ret == k:
			ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


(n, k) = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
a.sort()
b = float('inf')
for i in range(n - k + 1):
	for j in range(i + k - 1, n):
		p = a[j][0] - a[i][0]
		c = sorted([d[1] for d in a[i:j + 1]])
		for s in range(j - i - k + 2):
			q = c[s + k - 1] - c[s]
			b = min(b, p * q)
print(b)


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def main():
	(n, k) = MI()
	xy = []
	xx = []
	yy = []
	for _ in range(n):
		(x, y) = MI()
		xy.append([x, y])
		xx.append(x)
		yy.append(y)
	xx.sort()
	yy.sort()
	xtoi = {x: i for (i, x) in enumerate(xx)}
	ytoj = {y: j for (j, y) in enumerate(yy)}
	cs2d = [[0] * (n + 1) for _ in range(n + 1)]
	for (x, y) in xy:
		(i, j) = (xtoi[x], ytoj[y])
		cs2d[i + 1][j + 1] = 1
	for i in range(1, n + 1):
		for j in range(1, n + 1):
			cs2d[i][j] += cs2d[i][j - 1]
	for j in range(1, n + 1):
		for i in range(1, n + 1):
			cs2d[i][j] += cs2d[i - 1][j]
	ans = 10 ** 20
	for ri in range(n):
		r = xx[ri]
		for li in range(ri):
			l = xx[li]
			for ti in range(n):
				t = yy[ti]
				for bi in range(ti):
					b = yy[bi]
					cnt = cs2d[ri + 1][ti + 1] - cs2d[ri + 1][bi] - cs2d[li][ti + 1] + cs2d[li][bi]
					if cnt >= k:
						s = (r - l) * (t - b)
						if s < ans:
							ans = s
	print(ans)
main()


(N, K) = map(int, input().split())
P = [tuple(map(int, input().split())) for _ in range(N)]
X = sorted([p[0] for p in P])
Y = sorted([p[1] for p in P])
ans = 10 ** 20
for i in range(N - 1):
	for j in range(i + 1, N):
		x0 = X[i]
		x1 = X[j]
		for k in range(N - 1):
			for l in range(k + 1, N):
				y0 = Y[k]
				y1 = Y[l]
				c = 0
				for m in range(N):
					if x0 <= P[m][0] <= x1 and y0 <= P[m][1] <= y1:
						c += 1
				if c >= K:
					ans = min(ans, (x1 - x0) * (y1 - y0))
print(ans)


(n, k) = map(int, input().split())
xs = set()
ys = set()
ps = []
for _ in range(n):
	(x, y) = map(int, input().split())
	ps.append((x, y))
	xs.add(x)
	ys.add(y)
xdic = {x: i for (i, x) in enumerate(sorted(list(xs)))}
ydic = {y: i for (i, y) in enumerate(sorted(list(ys)))}
rxdic = {i: x for (i, x) in enumerate(sorted(list(xs)))}
rydic = {i: y for (i, y) in enumerate(sorted(list(ys)))}
h = len(xdic)
w = len(ydic)
A = [[0 for i in range(w + 1)] for j in range(h + 1)]
Acum = [[0 for i in range(w + 1)] for j in range(h + 1)]
for (x, y) in ps:
	h = xdic[x]
	w = ydic[y]
	A[h][w] += 1
for i in range(len(xdic)):
	for j in range(len(ydic)):
		Acum[i + 1][j + 1] = Acum[i][j + 1] + Acum[i + 1][j] - Acum[i][j] + A[i][j]
ans = 1 << 100
h = len(xdic)
w = len(ydic)
for i1 in range(h + 1):
	for i2 in range(i1 + 1, h + 1):
		for j1 in range(w + 1):
			for j2 in range(j1 + 1, w + 1):
				num = Acum[i2][j2] - Acum[i1][j2] - Acum[i2][j1] + Acum[i1][j1]
				if num == k:
					x1 = rxdic[i1]
					x2 = rxdic[i2 - 1]
					y1 = rydic[j1]
					y2 = rydic[j2 - 1]
					S = (x2 - x1) * (y2 - y1)
					ans = min(ans, S)
print(ans)


from itertools import combinations as cc
l = []
(n, k) = map(int, input().split())
(xs, ys) = (set(), set())
t = 10 ** 24
for _ in range(n):
	(x, y) = map(int, input().split())
	xs.add(x)
	ys.add(y)
	l.append((x, y))
xs = sorted(list(xs))
ys = sorted(list(ys))
for (xl, xr) in cc(xs, 2):
	for (yl, yr) in cc(ys, 2):
		cnt = 0
		for (x, y) in l:
			if xl <= x <= xr and yl <= y <= yr:
				cnt += 1
			if cnt >= k:
				s = (xr - xl) * (yr - yl)
				if t > s:
					t = s
print(t)


(n, k) = map(int, input().split())
xy = []
X = []
Y = []
for i in range(n):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
	xy.append([x, y])
X.sort()
Y.sort()
ans = float('inf')
for i in range(n):
	for j in range(i + 1, n):
		for l in range(n):
			for m in range(l + 1, n):
				count = 0
				for o in range(n):
					if X[i] <= xy[o][0] <= X[j] and Y[l] <= xy[o][1] <= Y[m]:
						count += 1
				if count >= k:
					ans = min(ans, (X[j] - X[i]) * (Y[m] - Y[l]))
print(ans)


from itertools import combinations
(n, k) = map(int, input().split())
Px = sorted([list(map(int, input().split())) for i in range(n)])
Py = sorted(Px, key=lambda p: p[1])
area = float('inf')
for x1 in range(n - 1):
	for x2 in range(x1 + 1, n):
		for y1 in range(n - 1):
			point = 0
			for y in range(y1, n):
				if Px[x1][0] <= Py[y][0] <= Px[x2][0]:
					point += 1
					if point == k:
						area = min(area, (Px[x2][0] - Px[x1][0]) * (Py[y][1] - Py[y1][1]))
						break
print(area)


(N, K) = map(int, input().split())
xy = []
for i in range(N):
	xy.append(tuple(map(int, input().split())))
xy = sorted(xy, key=lambda x: x[0])
lst = []
for left in range(0, N - K + 1):
	for right in range(left + K - 1, N):
		W = xy[right][0] - xy[left][0]
		temp = sorted(xy[left:right + 1], key=lambda x: x[1])
		for bottom in range(0, right - left + 1 - K + 1):
			H = temp[bottom + K - 1][1] - temp[bottom][1]
			lst.append(H * W)
print(min(lst))


import itertools
(N, K) = map(int, input().split())
X = []
Y = []
for _ in range(N):
	(x, y) = map(int, input().split())
	X.append(x)
	Y.append(y)
min_area = 5 * 10 ** 18
for (x1, x2) in itertools.combinations(X, 2):
	for (y1, y2) in itertools.combinations(Y, 2):
		if x1 > x2:
			(x1, x2) = (x2, x1)
		if y1 > y2:
			(y1, y2) = (y2, y1)
		area = (x2 - x1) * (y2 - y1)
		if area > min_area:
			continue
		cnt = 0
		for (x, y) in zip(X, Y):
			if x1 <= x <= x2 and y1 <= y <= y2:
				cnt += 1
		if cnt < K:
			continue
		min_area = area
print(min_area)


(N, K) = map(int, input().split())
points = [tuple(map(int, input().split())) for i in range(N)]
answer = 10 ** 19
sortx = sorted(points)
numberx = list(enumerate(sortx))
for (left, (x1, y1)) in numberx[:N - K + 1]:
	for (right, (x2, y2)) in numberx[left + K - 1:]:
		dx = x2 - x1
		sorty = sorted((y for (x, y) in sortx[left:right + 1]))
		for (y3, y4) in zip(sorty, sorty[K - 1:]):
			if y3 <= y1 and y3 <= y2 and (y4 >= y1) and (y4 >= y2):
				answer = min(answer, dx * (y4 - y3))
print(answer)


import heapq
(n, k) = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
x = [l[i][0] for i in range(n)]
x.sort()
y = [l[i][1] for i in range(n)]
y.sort()
ans = []
for i1 in range(n):
	for i2 in range(i1 + 1, n):
		for i3 in range(n):
			for i4 in range(i3 + 1, n):
				ct = 0
				for i5 in range(n):
					if x[i1] <= l[i5][0] <= x[i2] and y[i3] <= l[i5][1] <= y[i4]:
						ct += 1
				if ct >= k:
					ans.append(abs(x[i1] - x[i2]) * abs(y[i3] - y[i4]))
heapq.heapify(ans)
print(heapq.heappop(ans))


(n, k) = map(int, input().split())
XY = [[0] * 2 for i in range(n)]
X = [0] * n
Y = [0] * n
Z = [i for i in range(1, n + 1)]
for i in range(n):
	(X[i], Y[i]) = map(int, input().split())
	XY[i] = [X[i], Y[i]]
X.sort()
Y.sort()
XX = dict(zip(X, Z))
YY = dict(zip(Y, Z))
XXX = dict(zip(Z, X))
YYY = dict(zip(Z, Y))
A = [[0] * n for i in range(n)]
for i in range(n):
	A[XX[XY[i][0]] - 1][YY[XY[i][1]] - 1] += 1
C = [[0] * (n + 1) for i in range(n + 1)]
for i in range(1, n + 1):
	for j in range(1, n + 1):
		C[i][j] = C[i - 1][j] + C[i][j - 1] - C[i - 1][j - 1] + A[i - 1][j - 1]
ans = 10 ** 20
for i in range(1, n):
	for j in range(i + 1, n + 1):
		for s in range(1, n):
			for t in range(s + 1, n + 1):
				if C[j][t] - C[j][s - 1] - C[i - 1][t] + C[i - 1][s - 1] < k:
					continue
				a = (XXX[j] - XXX[i]) * (YYY[t] - YYY[s])
				if a < ans:
					ans = a
print(ans)


from itertools import accumulate
from operator import add
(N, K) = list(map(int, input().split()))
(xs, ys) = ([], [])
for _ in range(N):
	(x, y) = list(map(int, input().split()))
	xs.append(x)
	ys.append(y)
iXs = list(range(N))
iXs.sort(key=lambda iX: xs[iX])
odrXs = [0] * N
for (odrX, iX) in enumerate(iXs):
	odrXs[iX] = odrX
iYs = list(range(N))
iYs.sort(key=lambda iY: ys[iY])
odrYs = [0] * N
for (odrY, iY) in enumerate(iYs):
	odrYs[iY] = odrY
Ass = [[0] * N for _ in range(N)]
for (odrX, odrY) in zip(odrXs, odrYs):
	Ass[odrX][odrY] = 1

def getAccAss(Ass):
	accAss = [[0] * (len(Ass[0]) + 1)] + [accumulate([0] + As) for As in Ass]
	for x in range(1, len(accAss)):
		accAss[x] = list(map(add, accAss[x], accAss[x - 1]))
	return accAss

def getRangeSum2D(accAss, xFr, xTo, yFr, yTo):
	return accAss[xTo + 1][yTo + 1] - accAss[xTo + 1][yFr] - accAss[xFr][yTo + 1] + accAss[xFr][yFr]
accAss = getAccAss(Ass)
ans = 10 ** 20
for xFr in range(N - 1):
	for xTo in range(xFr + 1, N):
		for yFr in range(N - 1):
			for yTo in range(yFr + 1, N):
				num = getRangeSum2D(accAss, xFr, xTo, yFr, yTo)
				if num >= K:
					area = (xs[iXs[xTo]] - xs[iXs[xFr]]) * (ys[iYs[yTo]] - ys[iYs[yFr]])
					ans = min(ans, area)
print(ans)


(n, k) = map(int, input().split())
XY = [list(map(int, input().split())) for _ in [0] * n]
a = XY.sort()
ans = float('inf')
for i in range(n - k + 1):
	for j in range(i + k, 1 + n):
		x = XY[j - 1][0] - XY[i][0]
		now = XY[i:j]
		now.sort(key=lambda x: x[1])
		for w in range(j - i - k + 1):
			ans = min(ans, x * (now[w + k - 1][1] - now[w][1]))
print(ans)


(n, K) = list(map(int, input().split()))
xy = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: x[0])
dp = [[[] for _ in range(n)] for _ in range(n)]
for i in range(n):
	for j in range(i + 1, n):
		for k in range(i, j + 1):
			dp[i][j].append(xy[k][1])
		dp[i][j].sort()
ans = 10 ** 19
for x in range(K, n + 1):
	for i in range(n - x + 1):
		left = xy[i][0]
		right = xy[i + x - 1][0]
		for j in range(len(dp[i][i + x - 1]) - K + 1):
			down = dp[i][i + x - 1][j]
			up = dp[i][i + x - 1][j + K - 1]
			ans = min(ans, (right - left) * (up - down))
print(ans)


(n, k) = map(int, input().split())
ary = [list(map(int, input().split())) for _ in range(n)]
ary.sort()
ans = float('Inf')
for i in range(n - k + 1):
	for j in range(k, n - i + 1):
		xmin = ary[i][0]
		xmax = ary[i + j - 1][0]
		ary_y = sorted(ary[i:i + j], key=lambda x: x[1])
		for l in range(len(ary_y) - k + 1):
			ymin = ary_y[l][1]
			ymax = ary_y[l + k - 1][1]
			ans = min(ans, (xmax - xmin) * (ymax - ymin))
print(ans)


(N, K) = map(int, input().split())
xy = [tuple(map(int, input().split())) for _ in range(N)]
xy.sort(key=lambda t: t[0])
ans = 10 ** 20
for i in range(N):
	for j in range(i + K - 1, N):
		xlen = xy[j][0] - xy[i][0]
		ys = []
		for k in range(i, j + 1):
			ys.append(xy[k][1])
		ys.sort()
		ylen = 10 ** 20
		for k in range(len(ys) - K + 1):
			ylen = min(ylen, ys[k + K - 1] - ys[k])
		ans = min(ans, xlen * ylen)
print(ans)


(N, K) = map(int, input().split())
z = [0] * N
for i in range(N):
	(x, y) = map(int, input().split())
	z[i] = (x, y)
z.sort(key=lambda x: x[1])
H = z[N - 1][1] - z[0][1]
z.sort()
W = z[N - 1][0] - z[0][0]
ans = H * W
for i in range(N - K + 1):
	for j in range(i + K - 1, N):
		z_ = z[i:j + 1].copy()
		W = z_[-1][0] - z_[0][0]
		z_.sort(key=lambda x: x[1])
		for k in range(len(z_) - K + 1):
			H = z_[k + K - 1][1] - z_[k][1]
			if H * W < ans:
				ans = H * W
print(ans)


import itertools
(n, k) = map(int, input().split())
p = []
x = []
y = []
for i in range(n):
	(xi, yi) = map(int, input().split())
	p.append((xi, yi))
	x.append(xi)
	y.append(yi)
y = list(set(y))
x = list(set(x))
x.sort()
y.sort()
lx = len(x)
ly = len(y)
ans = 10 ** 20
for (xi, xj) in itertools.combinations(x, 2):
	for (yi, yj) in itertools.combinations(y, 2):
		cnt = 0
		for (xk, yk) in p:
			if xi <= xk and xk <= xj and (yi <= yk) and (yk <= yj):
				cnt += 1
		if cnt >= k:
			ans = min(ans, (xj - xi) * (yj - yi))
print(ans)


(n, k) = map(int, input().split())
x = [0] * n
y = [0] * n
a = []
for i in range(n):
	(x[i], y[i]) = map(int, input().split())
	a.append((x[i], y[i]))
ans = 4 * 10 ** 18
x.sort()
y.sort()
for i in range(n - 1):
	for j in range(i + 1, n):
		for l in range(n - 1):
			for m in range(l + 1, n):
				L = x[i]
				R = x[j]
				D = y[l]
				U = y[m]
				if L == R or U == D:
					continue
				cnt = 0
				for s in a:
					if L <= s[0] <= R and D <= s[1] <= U:
						cnt += 1
				if cnt >= k:
					ans = min(ans, (R - L) * (U - D))
print(ans)


(n, k) = (int(i) for i in input().split())
p = [[int(i) for i in input().split()] for i in range(n)]
(p, ans) = (sorted(p), float('inf'))
q = list(enumerate(p))
for (i, (a, b)) in q[:n - k + 1]:
	for (j, (c, d)) in q[i + k - 1:]:
		r = sorted((y for (x, y) in p[i:j + 1]))
		r2 = r[k - 1:]
		for (i2, j2) in zip(r, r2):
			if i2 <= b and d <= j2:
				ans = min(ans, (c - a) * (j2 - i2))
print(ans)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
xy = [tuple(map(int, input().split())) for _ in range(n)]
X = sorted(set((xy[i][0] for i in range(n))))
Y = sorted(set((xy[i][1] for i in range(n))))
from itertools import combinations
ans = 10 ** 20
for (x1, x2) in combinations(X, 2):
	for (y1, y2) in combinations(Y, 2):
		c = 0
		for (x, y) in xy:
			if x1 <= x <= x2 and y1 <= y <= y2:
				c += 1
		if c >= k:
			ans = min(ans, (x2 - x1) * (y2 - y1))
print(ans)


(n, k) = map(int, input().split())
graph = []
Y = []
X = []
for _ in range(n):
	(x, y) = map(int, input().split())
	graph.append([x, y])
	Y.append(y)
	X.append(x)
Y.sort()
X.sort()
ans = []
for sx in range(n):
	for ex in range(n - 1, sx, -1):
		for sy in range(n):
			for ey in range(n - 1, sy, -1):
				(x1, x2, y1, y2) = (X[sx], X[ex], Y[sy], Y[ey])
				count = len([True for (x, y) in graph if x1 <= x <= x2 and y1 <= y <= y2])
				if count >= k:
					ans.append((x2 - x1) * (y2 - y1))
				else:
					break
print(min(ans))


(N, K) = map(int, input().split(' '))
points = [tuple(map(int, input().split(' '))) for _ in range(N)]
points.sort()
ans = float('inf')
for i in range(N):
	for j in range(i + K - 1, N):
		(xmin, xmax) = (points[i][0], points[j][0])
		que = []
		for k in range(N):
			if xmin <= points[k][0] <= xmax:
				que.append(points[k][1])
		if len(que) >= K:
			que.sort()
			for k in range(len(que) - K + 1):
				ans = min(ans, (max(que[k:k + K]) - min(que[k:k + K])) * (xmax - xmin))
print(ans)


(N, K) = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(N)]
XY.sort()
answer = []
for i in range(N):
	for k in range(K, N + 1):
		if i + k - 1 >= N:
			break
		dx = XY[i + k - 1][0] - XY[i][0]
		Y = []
		for (x, y) in XY[i:i + k]:
			Y.append(y)
		Y.sort()
		lenY = len(Y)
		for j in range(k):
			if j + K - 1 == lenY:
				break
			dy = Y[j + K - 1] - Y[j]
			answer.append(dx * dy)
print(min(answer))