uses math;
const
    max_n = 100000;
    c = 1000000;
type
    double = extended;
var
    x, y, l: array[1..2 * max_n] of double;
    i, n, m: longint;
    l1, l2: double;
    i1, i2: longint;
    tl: double;
    ml, mp, h: double;

procedure advance(var i: longint; var p: double; dl: double);
begin
    p := p + dl;
    while (p >= l[i]) do begin
        p := p - l[i];
        i := i mod n + 1;
    end;
end;

function getX(i: longint; p: double): double;
begin
    getX := (x[i + 1] - x[i]) / l[i] * p + x[i];
end;

function getY(i: longint; p: double): double;
begin
    getY := (y[i + 1] - y[i]) / l[i] * p + y[i];
end;

begin
    reset(input, 'trolleys.in');
    rewrite(output, 'trolleys.out');

    read(n, m);
    for i := 1 to n do begin
        read(x[i], y[i]);
        x[i + n] := x[i];
        y[i + n] := y[i];
    end;

    tl := 0;
    for i := 1 to n do begin
        l[i] := hypot(x[i] - x[i + 1], y[i] - y[i + 1]);
        l[i + n] := l[i];
        tl := tl + l[i];
    end;

    i1 := 1;
    l1 := tl / m;
    i2 := 1;
    l2 := 0;
    advance(i1, l1, 0);
    advance(i2, l2, 0);

    ml := 1e100;
    mp := 0;
    for i := 0 to c do begin
        h := hypot(getX(i1, l1) - getX(i2, l2), getY(i1, l1) - getY(i2, l2));
        if (ml > h) then begin
            ml := h;
            mp := tl / c * i;
        end;
        advance(i1, l1, tl / c);
        advance(i2, l2, tl / c);
    end;

    i1 := 1;
    l1 := tl / m;
    i2 := 1;
    l2 := 0;
    advance(i1, l1, mp - tl / c);
    advance(i2, l2, mp - tl / c);

    for i := 0 to 2 * c do begin
        h := hypot(getX(i1, l1) - getX(i2, l2), getY(i1, l1) - getY(i2, l2));
        if (ml > h) then begin
            ml := h;
        end;
        advance(i1, l1, tl / c / c);
        advance(i2, l2, tl / c / c);
    end;

    writeln(ml);
end.