CodeEff/ECCO huggingface dataset:
# Original solution
# -*- coding: utf-8 -*-
N, K = list(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]))


ans = float('inf')
import itertools
all_indices = list(range(N))
for part_x in itertools.combinations(X, 2):
    for part_y in itertools.combinations(Y, 2):
        max_x = max(part_x)
        min_x = min(part_x)
        max_y = max(part_y)
        min_y = min(part_y)

        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)

# Optimized solution
# -*- coding: utf-8 -*-
N, K = list(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)
# Original solution
N,K = list(map(int,input().split()))
p = [list(map(int,input().split())) for i in range(N)]
used = [False for i in range(N)]
def dfs(p,K,d=0,ans=[[],[]],s=float('inf')):
    if K==d:
        s = abs(max(ans[0])-min(ans[0]))*abs(max(ans[1])-min(ans[1]))
        return s
    for i in range(len(p)):
        if used[i]:
            continue
        used[i] = True
        ans[0].append(p[i][0])
        ans[1].append(p[i][1])
        s = min(s,dfs(p,K,d+1,ans))
        del ans[0][d]
        del ans[1][d]
        used[i] = False
    return s
print((dfs(p,K)))


# Optimized solution
N,K = list(map(int,input().split()))
X,Y = [],[]
p = []
for i in range(N):
    x,y = list(map(int,input().split()))
    X.append(x)
    Y.append(y)
    p.append([x,y])
X.sort(),Y.sort()
ans = abs(X[N-1]-X[0])*abs(Y[N-1]-Y[0])
for xi in range(N):
    for xj in range(xi+1,N):
        for yi in range(N):
            for yj in range(yi+1,N):
                lx,rx = X[xi],X[xj]
                dy,uy = Y[yi],Y[yj]
                num = 0
                for x,y in p:
                    if lx<=x and x<=rx and dy<=y and y<=uy:
                        num += 1
                if K==num:
                    ans = min(abs(rx-lx)*abs(uy-dy),ans)
print(ans)
# Original solution
# -*- coding: utf-8 -*-

"""
参考：https://img.atcoder.jp/abc075/editorial.pdf
・自力ACしたのがO(N^4)でこれはO(N^5)の愚直解
・制約からして何とかなりそうだし、こっちのが実装全然軽いし実戦向きぽいね。
"""

N, K = list(map(int, input().split()))

X, Y = [0]*N, [0]*N
for i in range(N):
    X[i], Y[i] = list(map(int, input().split()))

X2 = sorted(set(X))
Y2 = sorted(set(Y))

ans = float('inf')
# 可能性のある全長方形ループ
for x1 in X2:
    for y1 in Y2:
        for x2 in X2:
            for y2 in Y2:
                cnt = 0
                # 各頂点ループで範囲内にあるか1つずつ確認する
                for i in range(N):
                    if x1 <= X[i] <= x2 and y1 <= Y[i] <= y2:
                        cnt += 1
                if cnt >= K:
                    ans = min((x2 - x1) * (y2 - y1), ans)
print(ans)


# Optimized solution
# -*- coding: utf-8 -*-

"""
参考：https://img.atcoder.jp/abc075/editorial.pdf
・自力ACしたのがO(N^4)でこれはO(N^5)の愚直解
・制約からして何とかなりそうだし、こっちのが実装全然軽いし実戦向きぽいね。
　→O(N^5)=50^5=3億1250万はpypyでも無理だったわ。
・添字見づらくなったけど定数倍改善。多分半分で約1憶5000万かと。
"""

N, K = list(map(int, input().split()))

X, Y = [0]*N, [0]*N
for i in range(N):
    X[i], Y[i] = list(map(int, input().split()))

X2 = sorted(set(X))
Y2 = sorted(set(Y))

ans = float('inf')
# 可能性のある全長方形ループ
for i in range(len(X2)):
    for j in range(len(Y2)):
        for k in range(i+1, len(X2)):
            for l in range(j+1, len(Y2)):
                cnt = 0
                # 各頂点ループで範囲内にあるか1つずつ確認する
                for m in range(N):
                    if X2[i] <= X[m] <= X2[k] and Y2[j] <= Y[m] <= Y2[l]:
                        cnt += 1
                if cnt >= K:
                    ans = min((X2[k] - X2[i]) * (Y2[l] - Y2[j]), ans)
print(ans)
# Original solution
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')
# 端の4点、まずはx軸の2点を選ぶ
for left,right in itertools.combinations(list(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)

# Optimized solution
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')
# 端の4点、まずはx軸の2点を選ぶ
for left,right in itertools.combinations(list(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):
    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)
# Original solution
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')
# 端の4点、まずはx軸の2点を選ぶ
for left,right in itertools.combinations(list(range(N)),2):
  xleft = XY[left][0]
  xright = XY[right][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):
    y_max = pts[D+K-1][1]
    y_min = pts[D][1]
    area = (y_max - y_min) * (xright - xleft)
    if area < answer:
      answer = area
    
print(answer)


# Optimized solution
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')
# 端の4点、まずはx軸の2点を選ぶ
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)
# 31
# Original solution
import sys
input = sys.stdin.readline

N,K=[int(val) for val in input().split()]

list_x=list()
list_y=list()
list_z=list()

ans=float('inf')

for i in range(N):
  x,y=(int(val) for val in input().split())
  list_x.append(x)
  list_y.append(y)
  list_z.append((x,y))

list_x.sort()
list_y.sort()

for i in list_y:
  for j in list_y:
    for k in list_x:
      for l in list_x:
        cnt=0
        for m in range(len(list_z)):
          if l<=list_z[m][0]<=k and j<=list_z[m][1]<=i:
            cnt+=1
          if K <= cnt:
            tmp=(i-j)*(k-l)
            if tmp < ans:
              ans=tmp

print(ans)




# Optimized solution
import sys
input = sys.stdin.readline

N,K=[int(val) for val in input().split()]

list_x=list()
list_y=list()
list_z=list()

ans=float('inf')

for i in range(N):
  x,y=(int(val) for val in input().split())
  list_x.append(x)
  list_y.append(y)
  list_z.append((x,y))
#  heapq.heappush(list_x, x)
#  heapq.heappush(list_y, y)
list_x.sort()
list_y.sort()

for i in list_y:
  for j in list_y:
    if i<=j:
      break
    else:
      for k in list_x:
        for l in list_x:
          if k<=l:
            break
          else:
            cnt=0
            for m in range(len(list_z)):
              if l<=list_z[m][0]<=k and j<=list_z[m][1]<=i:
                cnt+=1
              if K <= cnt:
                tmp=(i-j)*(k-l)
                if tmp < ans:
                  ans=tmp
                break

print(ans)
# Original solution
import itertools

N,K=list(map(int,input().split()))
x=[]
y=[]
sx=[]
sy=[]
for i in range(N):
	a1,a2=list(map(int,input().split()))
	x.append(a1)
	sx.append(a1)
	y.append(a2)
	sy.append(a2)

#print "# x,y"
#print x
#print y


ans=10**20
#print ans
for i in range(N):
	for j in range(N):
		for k in range(N):
			for l in range(N):
				cnt=0
				if x[i]<x[j] and y[k]<y[l]:
					#print i,j,k,l,x[i],y[k],x[j],y[l],sx.index(x[i]),sx.index(x[j]),abs(x[i]-x[j])*abs(y[k]-y[l])
					for m in range(N):
						x_t=x[m]
						y_t=y[m]
						if (x_t>=x[i] and x_t<=x[j]) or (x_t>=x[j] and x_t<=x[i]):
							if (y_t>=y[k] and y_t<=y[l]) or (y_t>=y[l] and y_t<=y[k]):
								cnt+=1
					
				
				#print cnt
				if cnt>=K:
					#print x[i],y[k],x[j],y[l],cnt,abs(x[i]-x[j])*abs(y[k]-y[l])
					ans=min(ans,abs(x[i]-x[j])*abs(y[k]-y[l]))


print(ans)


# Optimized solution
import itertools

N,K=list(map(int,input().split()))
x=[]
y=[]
pts=[]
for i in range(N):
	a1,a2=list(map(int,input().split()))
	x.append(a1)
	y.append(a2)
	pts.append([a1,a2])

#print "# x,y"
x.sort()
y.sort()
#print x
#print y

#print "# pts"
#print pts
pts.sort(key=lambda x:x[0])
#print pts

ans=10**20


for y1 in y:
	for y2 in y:
		if y1>=y2:
			continue
		for x1 in x:
			cnt=0
			for p in pts:
				if p[0]>=x1 and p[1]>=y1 and p[1]<=y2:
					#print p[0],p[1],x1,y1,y2
					cnt+=1
					if cnt==K:
						x2=p[0]
						#print x1,y1,x2,y2,cnt,abs(x2-x1)*abs(y2-y1)
						ans=min(ans,abs(x2-x1)*abs(y2-y1))
						break

print(ans)
# Original solution
import sys
import itertools

N,K=list(map(int, sys.stdin.readline().split()))
X=[]
Y=[]
XY=[]

for _ in range(N):
	x,y=list(map(int, sys.stdin.readline().split()))
	X.append(x)
	Y.append(y)
	XY.append( (x,y) )
X.sort()
Y.sort()

L=list( itertools.product(X,Y ) )

ans=float("inf")

for x1,y1 in L:
	for x2,y2 in L:
		cnt=0
		for x, y in XY:
			if x1<=x<=x2 and y1<=y<=y2:
				cnt+=1
	
		menseki=abs(x1-x2)*abs(y1-y2)
		if K<=cnt:
			ans=min(ans, menseki)

print(ans)

# Optimized solution
import sys

N,K=list(map(int, sys.stdin.readline().split()))
X=[]
Y=[]
XY=[]

for _ in range(N):
	x,y=list(map(int, sys.stdin.readline().split()))
	X.append(x)
	Y.append(y)
	XY.append( (x,y) )

ans=float("inf")
for x1 in X:
	for y1 in Y:
		for x2 in X:
			for y2 in Y:
				if x1<x2 and y1<y2:
					cnt=0
					for x, y in XY:
						if x1<=x<=x2 and y1<=y<=y2:
							cnt+=1
	
					menseki=abs(x1-x2)*abs(y1-y2)
					if K<=cnt:
						ans=min(ans, menseki)
			
print(ans)
# Original solution
n,k = list(map(int,input().split()))
xy = [list(map(int,input().split())) for _ in range(n)]

ans = 10 ** 20

for i in range(n):
    for j in range(i+1, n):
        for ii in range(n):
            for jj in range(ii+1, n):
                l = min(xy[i][0], xy[j][0])
                r = max(xy[i][0], xy[j][0])
                d = min(xy[ii][1], xy[jj][1])
                u = max(xy[ii][1], xy[jj][1])
                cnt = 0
                for x,y in xy:
                    if l <= x <= r and d <= y <= u:
                        cnt += 1
                if cnt >= k:
                    ans = min(ans, (r-l) * (u - d))

print(ans)


# Optimized solution
def main():
    n,k = list(map(int,input().split()))
    xy = [list(map(int,input().split())) for _ in range(n)]

    ans = 10 ** 20

    for i in range(n):
        for j in range(i+1, n):
            for ii in range(n):
                for jj in range(ii+1, n):
                    l = min(xy[i][0], xy[j][0])
                    r = max(xy[i][0], xy[j][0])
                    d = min(xy[ii][1], xy[jj][1])
                    u = max(xy[ii][1], xy[jj][1])
                    cnt = 0
                    for x,y in xy:
                        if l <= x <= r and d <= y <= u:
                            cnt += 1
                    if cnt >= k:
                        ans = min(ans, (r-l) * (u - d))

    print(ans)

if __name__ == '__main__':
    main()
# Original solution
def main():
    n,k = list(map(int,input().split()))
    xy = [list(map(int,input().split())) for _ in range(n)]

    ans = 10 ** 20

    for i in range(n):
        for j in range(i+1, n):
            for ii in range(n):
                for jj in range(ii+1, n):
                    l = min(xy[i][0], xy[j][0])
                    r = max(xy[i][0], xy[j][0])
                    d = min(xy[ii][1], xy[jj][1])
                    u = max(xy[ii][1], xy[jj][1])
                    cnt = 0
                    for x,y in xy:
                        if l <= x <= r and d <= y <= u:
                            cnt += 1
                    if cnt >= k:
                        ans = min(ans, (r-l) * (u - d))

    print(ans)

if __name__ == '__main__':
    main()


# Optimized solution
n,k = list(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)
# Original solution
import itertools

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]

k_list = list(itertools.combinations(list(range(n)), k))
min_area = ((10 ** 9) * 2) ** 2

for ki in k_list:
    x_list = []
    y_list = []
    for i in ki:
        x_list.append(p_list[i][0])
        y_list.append(p_list[i][1])
    x_max = max(x_list)
    x_min = min(x_list)
    y_max = max(y_list)
    y_min = min(y_list)
    area = abs(x_max - x_min) * abs(y_max - y_min)
    if area < min_area:
        min_area = area

print(min_area)



# Optimized solution
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)
# Original solution
N,K = list(map(int,input().split()))
x = []
y = []
l = []
for i in range(N):
    xx,yy = list(map(int,input().split()))
    x.append(xx)
    y.append(yy)
    l.append((xx,yy))

x = sorted(x)
y = sorted(y)

import itertools
ans = float("inf")

for xx in itertools.combinations(x,2):
    for i in range(N):
        if x[i] == xx[0]:
            xai = i
        if x[i] == xx[1]:
            xbi = i

    for yy in itertools.combinations(y,2):
        for i in range(N):
            if y[i] == yy[0]:
                yai = i
            if y[i] == yy[1]:
                ybi = i

        if x[xai] > x[xbi] and y[yai] > y[ybi]:
            continue

        num = 0
        for i in range(N):
            if l[i][0] >= x[xai] and l[i][0] <= x[xbi] and l[i][1] >= y[yai] and l[i][1] <= y[ybi]:
                num += 1

        if K > num:
            continue

        ans = min(ans , abs(xx[0] - xx[1])*abs(yy[0] - yy[1]))
print(ans)





# Optimized solution
N,K = list(map(int,input().split()))
x = []
y = []
l = []
for i in range(N):
    xx,yy = list(map(int,input().split()))
    x.append(xx)
    y.append(yy)
    l.append((xx,yy))

x = sorted(x)
y = sorted(y)

import itertools
ans = float("inf")

for xx in itertools.combinations(x,2):
    for i in range(N):
        if x[i] == xx[0]:
            xai = i
        if x[i] == xx[1]:
            xbi = i

    if x[xai] > x[xbi]:
        continue

    for yy in itertools.combinations(y,2):
        for i in range(N):
            if y[i] == yy[0]:
                yai = i
            if y[i] == yy[1]:
                ybi = i

        if y[yai] > y[ybi]:
            continue

        num = 0
        for i in range(N):
            if l[i][0] >= x[xai] and l[i][0] <= x[xbi] and l[i][1] >= y[yai] and l[i][1] <= y[ybi]:
                num += 1

        if K > num:
            continue

        ans = min(ans , abs(xx[0] - xx[1])*abs(yy[0] - yy[1]))
print(ans)
# Original solution
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,K = inpl()
a = [inpl() for _ in range(n)]
res = INF
for i in range(1):
    a.sort(key=lambda x:x[i])
    for j in range(n-1):
        for k in range(j+1,n):
            l = a[j][i]
            r = a[k][i]
            b = [a[j],a[k]]
            cnt = 2
            for _ in range(n):
                if _ == j or _ == k:
                    continue
                if l < a[_][i] < r:
                    cnt += 1
                    b += [a[_]]
            if cnt < K: continue
            b.sort(key=lambda x:x[i^1])
            # print(j,k,b,i)
            for _ in range(cnt-K+1):
                u = max(x[i^1] for x in b[_:_+K])
                d = min(x[i^1] for x in b[_:_+K])
                res = min(res, (r-l)*(u-d))
                # print(res)
print(res)

# Optimized solution
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,K = inpl()
a = [inpl() for _ in range(n)]
res = INF
a.sort(key=lambda x:x[0])
for j in range(n-1):
    for k in range(j+1,n):
        l = a[j][0]
        r = a[k][0]
        b = [a[j],a[k]]
        cnt = 2
        for _ in range(n):
            if _ == j or _ == k:
                continue
            if l < a[_][0] < r:
                cnt += 1
                b += [a[_]]
        if cnt < K: continue
        b.sort(key=lambda x:x[1])
        for _ in range(cnt-K+1):
            u = max(x[1] for x in b[_:_+K])
            d = min(x[1] for x in b[_:_+K])
            res = min(res, (r-l)*(u-d))
            # print(res)
print(res)
# Original solution
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,k = inpl()
xary = []; yary = []
a = []
for i in range(n):
    x,y = inpl()
    xary += [x]; yary += [y]
    a += [[x,y]]
xary.sort(); yary.sort()
res = INF
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
                l = xary[xi]; r = xary[xj]
                d = yary[yi]; u = yary[yj]
                # print(l,r,d,u)
                for i in range(n):
                    x,y = a[i]
                    if l<=x<=r and d<=y<=u:
                        cnt += 1
                if cnt >= k:
                    res = min(res, (r-l)*(u-d))
print(res)


# Optimized solution
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

def main():
    n,k = inpl()
    xary = []; yary = []
    a = []
    x_append = xary.append
    y_append = yary.append
    a_append = a.append
    for i in range(n):
        x,y = inpl()
        x_append(x)
        y_append(y)
        a_append((x,y))
    xary.sort(); yary.sort()
    res = INF
    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
                    l = xary[xi]; r = xary[xj]
                    d = yary[yi]; u = yary[yj]
                    # print(l,r,d,u)
                    for i in range(n):
                        x,y = a[i]
                        if l<=x<=r and d<=y<=u:
                            cnt += 1
                    if cnt >= k:
                        res = min(res, (r-l)*(u-d))
    print(res)
if __name__ == "__main__":
    main()
# Original solution
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

def main():
    n,k = inpl()
    xary = []; yary = []
    a = []
    x_append = xary.append
    y_append = yary.append
    a_append = a.append
    for i in range(n):
        x,y = inpl()
        xary += [x]
        yary += [y]
        a += [[x,y]]
    xary.sort(); yary.sort()
    res = INF
    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
                    l = xary[xi]; r = xary[xj]
                    d = yary[yi]; u = yary[yj]
                    # print(l,r,d,u)
                    for i in range(n):
                        x,y = a[i]
                        if l<=x<=r and d<=y<=u:
                            cnt += 1
                    if cnt >= k:
                        res = min(res, (r-l)*(u-d))
    print(res)
if __name__ == "__main__":
    main()

# Optimized solution
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

def main():
    n,k = inpl()
    xary = []; yary = []
    a = []
    x_append = xary.append
    y_append = yary.append
    a_append = a.append
    for i in range(n):
        x,y = inpl()
        xary.append(x)
        yary.append(y)
        a.append((x,y))
    xary.sort(); yary.sort()
    res = INF
    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
                    l = xary[xi]; r = xary[xj]
                    d = yary[yi]; u = yary[yj]
                    # print(l,r,d,u)
                    for i in range(n):
                        x,y = a[i]
                        if l<=x<=r and d<=y<=u:
                            cnt += 1
                    if cnt >= k:
                        res = min(res, (r-l)*(u-d))
    print(res)
if __name__ == "__main__":
    main()