#include using namespace std; struct Point { int x, y; }; Point p0; Point points[100]; int n, k; bool used[100]; vector hull; Point nextToTop(stack &S) { Point p = S.top(); S.pop(); Point res = S.top(); S.push(p); return res; } int swap(Point &p1, Point &p2) { Point temp = p1; p1 = p2; p2 = temp; } int distSq(Point p1, Point p2) { return (p1.x - p2.x)*(p1.x - p2.x) + (p1.y - p2.y)*(p1.y - p2.y); } int orientation(Point p, Point q, Point r) { int val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); if (val == 0) return 0; return (val > 0)? 1: 2; } int compare(const void *vp1, const void *vp2) { Point *p1 = (Point *)vp1; Point *p2 = (Point *)vp2; int o = orientation(p0, *p1, *p2); if (o == 0) return (distSq(p0, *p2) >= distSq(p0, *p1))? -1 : 1; return (o == 2)? -1: 1; } void convexHull() { int ymin = points[0].y, min = 0; for (int i = 1; i < n; i++) { int y = points[i].y; if ((y < ymin) || (ymin == y && points[i].x < points[min].x)) ymin = points[i].y, min = i; } swap(points[0], points[min]); p0 = points[0]; qsort(&points[1], n-1, sizeof(Point), compare); int m = 1; for (int i=1; i S; S.push(points[0]); S.push(points[1]); S.push(points[2]); for (int i = 3; i < m; i++) { while (orientation(nextToTop(S), S.top(), points[i]) != 2) S.pop(); S.push(points[i]); } while (!S.empty()) { Point p = S.top(); hull.push_back(p); S.pop(); } } long long polygonArea() { long long area = 0; int j = hull.size() - 1; while (used[j] == true) j--; for (int i = 0; i < hull.size(); i++) { if (used[i]) continue; area += (long long)(hull[j].x + hull[i].x) * (hull[j].y - hull[i].y); j = i; } return abs(area); } void input() { cin >> n >> k; for (int i = 0; i < n; i++) { cin >> points[i].x >> points[i].y; } } void solve() { convexHull(); if (hull.size() < k) { cout << -1; return; } int sz = hull.size(); while (sz > k) { int ind = 0; long long maxx = 0; for (int i = 0; i < hull.size(); i++) { if (used[i]) continue; used[i] = true; long long res = polygonArea(); if (res > maxx) { ind = i; maxx = res; } used[i] = false; } used[ind] = true; sz--; } /*for (int i = 0; i < hull.size(); i++) { if (used[i]) continue; cout << "(" << hull[i].x << ", " << hull[i].y << ")\n"; }*/ cout << polygonArea() << endl; } int main() { iostream::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); freopen("farm.in", "r", stdin); freopen("farm.out", "w", stdout); input(); solve(); return 0; } /* 10 4 1 1 3 1 5 2 7 3 9 3 9 5 7 7 4 8 2 6 1 4 */