Under construction

Still being built. Things may change

Kは多角形のケイ

Time limit8sMemory limit512 MB

Summary
Given N integer points, find the perimeter of the K-th shortest simple polygon with vertices at those points that contains all N points, or print -1 if there are fewer than K.
Level

Medium4 of 10

Topics
Geometry, Implementation
Solved
No attempts yet

Problem

"1 ban ja nakya dame desu ka? K ban ja dame na n deshou ka?" This is Kei's motto. Lately Kei seems fixated on polygons, and looking at NN points spread across a wide two-dimensional plane, Kei keeps thinking about how to form a polygon from them.

Kei picks some of the NN points and connects them in any order, so that the chosen points are the vertices of a polygon. The polygon must satisfy these conditions:

  • It is a simple polygon. That is, it has at least 3 vertices, and no two edges that are not consecutive share a point.
  • All NN points, including the ones not chosen, lie inside or on the boundary of the polygon.

Kei wants the polygon whose perimeter, the sum of all edge lengths, is the KK-th shortest among such polygons.

Your task is to help Kei. Among the polygons that satisfy the conditions, sort them by perimeter in ascending order and output the perimeter of the KK-th one. If there are fewer than KK such polygons, output −1-1 instead.

Input

The input consists of multiple datasets. Each dataset has the following format.

N K
x1 y1
...
xN yN

The first line of a dataset gives the number of points NN and the rank KK of the perimeter to find. Both NN and KK are integers, and 3≤N≤253 \le N \le 25, 1≤K≤101 \le K \le 10. The next NN lines give the coordinates of each point. On line ii, the x coordinate xix_i and the y coordinate yiy_i are integers. For all 1≤i≤N1 \le i \le N, −100≤xi,yi≤100-100 \le x_i, y_i \le 100.

You may assume that no line passes through any three distinct points. You may also assume that if the polygon with the KK-th smallest perimeter exists, it is uniquely determined.

The input ends with a line containing two zeros. The total number of datasets does not exceed 50.

Output

For each dataset, output on one line the perimeter of the KK-th shortest simple polygon that can be formed from the given points. If no such polygon exists, output -1. The result must have an error of less than 10−410^{-4}.

Examples1

  1. Example 1

    Input
    5 2
    1 1
    1 4
    2 2
    3 1
    3 5
    3 1
    0 2
    1 0
    -1 0
    3 2
    0 2
    1 0
    -1 0
    9 10
    8 1
    9 19
    2 10
    1 1
    4 17
    7 13
    3 4
    6 13
    9 21
    0 0
    
    Expected output
    11.812559200041266
    6.472135954999580
    -1
    52.202878812480016