def main():

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

    XY = [list(map(int,input().split())) for _ in [0]*N]

    

    iX = sorted(x for x,y in XY)

    iY = sorted(y for x,y in XY)

    X = {x:i for i,x in enumerate(iX)}

    Y = {y:i for i,y in enumerate(iY)}



    c = [[0]*(N+1) for i in [0]*(N+1)]

    for x,y in XY:

        c[Y[y]+1][X[x]+1] = 1



    for i in range(N):

        ci1 = c[i+1]

        for j in range(N):

            ci1[j+1] += ci1[j]

    for i in range(N):

        ci1 = c[i+1]

        ci = c[i]

        for j in range(N):

            ci1[j+1] += ci[j+1]



    ans = 10**20

    for u in range(N):

        for d in range(u+K-1,N):

            l = 0

            r = 1

            dY = iY[d]-iY[u]

            cd = c[d+1]

            cu = c[u]

            while r<N:

                if cd[r+1]+cu[l]-cu[r+1]-cd[l] >=K:

                    ans = min(ans, (iX[r] - iX[l])*dY)

                    l+=1

                else:r+=1



    print(ans)

main()
n,k=list(map(int,input().split()))

points=[]

for _ in range(n):

    x,y=list(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)
def main():
    N, K = list(map(int, input().split()))
    XY = [list(map(int, input().split())) for _ in [0] * N]
    iX = sorted(x for x, y in XY)
    iY = sorted(y for x, y in XY)
    X = {x: i for i, x in enumerate(iX)}
    Y = {y: i for i, y in enumerate(iY)}
    c = [[0] * (N + 1) for i in [0] * (N + 1)]
    for x, y in XY:
        c[Y[y] + 1][X[x] + 1] = 1
    for i in range(N):
        ci1 = c[i + 1]
        for j in range(N):
            ci1[j + 1] += ci1[j]
    for i in range(N):
        ci1 = c[i + 1]
        ci = c[i]
        for j in range(N):
            ci1[j + 1] += ci[j + 1]
    ans = 10**20
    for u in range(N):
        for d in range(u + K - 1, N):
            l = 0
            r = 1
            dY = iY[d] - iY[u]
            cd = c[d + 1]
            cu = c[u]
            while r < N:
                if cd[r + 1] + cu[l] - cu[r + 1] - cd[l] >= K:
                    ans = min(ans, (iX[r] - iX[l]) * dY)
                    l += 1
                else:
                    r += 1
    print(ans)


main()

n, k = list(map(int, input().split()))
points = []
for _ in range(n):
    x, y = list(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)

-def main(): -    N, K = list(map(int, input().split())) -    XY = [list(map(int, input().split())) for _ in [0] * N] -    iX = sorted(x for x, y in XY) -    iY = sorted(y for x, y in XY) -    X = {x: i for i, x in enumerate(iX)} -    Y = {y: i for i, y in enumerate(iY)} -    c = [[0] * (N + 1) for i in [0] * (N + 1)] -    for x, y in XY: -        c[Y[y] + 1][X[x] + 1] = 1 -    for i in range(N): -        ci1 = c[i + 1] -        for j in range(N): -            ci1[j + 1] += ci1[j] -    for i in range(N): -        ci1 = c[i + 1] -        ci = c[i] -        for j in range(N): -            ci1[j + 1] += ci[j + 1] -    ans = 10**20 -    for u in range(N): -        for d in range(u + K - 1, N): -            l = 0 -            r = 1 -            dY = iY[d] - iY[u] -            cd = c[d + 1] -            cu = c[u] -            while r < N: -                if cd[r + 1] + cu[l] - cu[r + 1] - cd[l] >= K: -                    ans = min(ans, (iX[r] - iX[l]) * dY) -                    l += 1 -                else: -                    r += 1 -    print(ans) - - -main() +n, k = list(map(int, input().split())) +points = [] +for _ in range(n): +    x, y = list(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)