#include<algorithm>
#include<complex>
#include<cstdio>
#include<iostream>
#include<queue>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)
template<class T> T at(vector<T> v, int i) {return v[i % v.size()];}

#define X real()
#define Y imag()

typedef double D;
typedef complex<D> P;
struct L{P a, b;};
typedef vector<P> Pol;

const D EPS = 1e-6;
const D PI = acos(-1);

// テヲツッツ氾ィツシツεゥツ鳴「テヲツ閉ー
int sig(D a, D b = 0) {return a < b - EPS ? -1 : a > b + EPS ? 1 : 0;}
bool near(P a, P b) {return !sig(norm(a - b));}
namespace std {
  bool operator<(P a, P b) {return sig(a.X, b.X) ? a.X < b.X : a.Y < b.Y;}
  bool operator<(L a, L b) {return !near(a.a, b.a) ? a.a < b.a : a.b < b.b;}
}

// テ・ツ、ツ姪ァツゥツ?
D det(P a, P b) {return a.X * b.Y - a.Y * b.X;}

// テァツキツ堙・ツ按?」ツ?ョテ」ツδ凖」ツつッテ」ツδ暗」ツδォ
P vec(L a) {return a.b - a.a;}

// テァツキツ堙・ツ按?bテ」ツ?ォテ・ツッツセテ」ツ?凖」ツつ凝ァツつケcテ」ツ?ョテ、ツスツ催ァツスツョ
enum CCW{FRONT = 1, RIGHT = 2, BACK = 4, LEFT = 8, ON = 16};
int ccw(P a, P b, P c) {
  if (near(a, c) || near(b, c)) return ON;
  int s = sig(det(b - a, c - a));
  if (s) return s > 0 ? LEFT : RIGHT;
  return (a < b) == (b < c) ? FRONT : (c < a) == (a < b) ? BACK : ON;
}

// テ、ツコツ、テ・ツキツョテ・ツ按、テ・ツョツ?
bool iLLs(L a, L b) {return sig(det(vec(a), vec(b)));}
bool iLSs(L a, L b) {return sig(det(vec(a), b.a - a.a)) * sig(det(vec(a), b.b - a.a)) < 0;}
bool iSS(L a, L b) {
  int cwa = ccw(a.a, a.b, b.a) | ccw(a.a, a.b, b.b);
  int cwb = ccw(b.a, b.b, a.a) | ccw(b.a, b.b, a.b);
  return ((cwa | cwb) & ON) || ((cwa & cwb) == (LEFT | RIGHT));
}

// テ、ツコツ、テァツつケ
P pLL(L a, L b) {return a.a + vec(a) * (det(vec(b), b.a - a.a) / det(vec(b), vec(a)));}

// テ・ツ、ツ堙ィツァツ津・ツスツ「テ」ツ?ョテ・ツ??・ツ、ツ姪・ツ按、テ・ツョツ?テ・ツ??ゥツδィ:1テ」ツ??・ツ堕ィテ、ツクツ?0テ」ツ??・ツ、ツ姪ゥツδィ:-1
int sGP(Pol pol, P p) {
  int side = -1;
  rep (i, pol.size()) {
    P p0 = pol[i] - p, p1 = at(pol, i + 1) - p;
    if (ccw(p0, p1, 0) == ON) return 0;
    if (p0.Y > p1.Y) swap(p0, p1);
    if (sig(p0.Y) <= 0 && 0 < sig(p1.Y) && sig(det(p0, p1)) > 0) side *= -1;
  }
  return side;
}

// テァツキツ堙・ツ按?」ツつ津」ツδ榲」ツδシテ」ツつクテ」ツ?凖」ツつ?
vector<L> merge(vector<L> s) {
  rep (i, s.size()) if (s[i].b < s[i].a) swap(s[i].a, s[i].b);
  sort(s.begin(), s.end());
  rep (i, s.size()) rep (j, i) if (iSS(s[i], s[j]) && !iLLs(s[i], s[j])) {
    s[j].b = max(s[i].b, s[j].b);
    s.erase(s.begin() + i--);
    break;
  }
  return s;
}

// テァツキツ堙・ツ按?」ツつ「テ」ツδャテ」ツδウテ」ツつクテ」ツδ。テ」ツδウテ」ツδ?テゥツ堋」テ」ツ?ョテァツつケテ」ツ?クテ」ツ?ョティツセツコテ」ツ?ョテ」ツ?ソテ」ツつ津ヲツ個?」ツ?、
vector<vector<int> > sArr(vector<L> s, vector<P> &vp) {
  s = merge(s);
  rep (i, s.size()) {
    vp.push_back(s[i].a);
    vp.push_back(s[i].b);
  }
  rep (i, s.size()) rep (j, i) if (iSS(s[i], s[j])) vp.push_back(pLL(s[i], s[j]));
  sort(vp.begin(), vp.end());
  vp.erase(unique(vp.begin(), vp.end(), near), vp.end());
  vector<vector<int> > g(vp.size());
  rep (i, s.size()) {
    vector<pair<D, int> > v;
    rep (j, vp.size()) if (ccw(s[i].a, s[i].b, vp[j]) == ON) {
      v.push_back(make_pair(norm(vp[j] - s[i].a), j));
    }
    sort(v.begin(), v.end());
    rep (j, v.size() - 1) {
      g[v[j + 1].second].push_back(v[j].second);
      g[v[j].second].push_back(v[j + 1].second);
    }
  }
  return g;
}

// テ」ツδ榲」ツδウテ」ツδ湘」ツδε」ツつソテ」ツδウティツキツ敕ゥツ崢「
D dmPP(P a, P b) {return abs(a.X - b.X) + abs(a.Y - b.Y);}
D dmSP(L s, P p) {
  D res = min(dmPP(s.a, p), dmPP(s.b, p));
  L l = {p, p + P(1, 0)};
  if (iLSs(l, s)) res = min(res, dmPP(p, pLL(l, s)));
  l = (L){p, p + P(0, 1)};
  if (iLSs(l, s)) res = min(res, dmPP(p, pLL(l, s)));
  return res;
}
D dmSS(L a, L b) {return iSS(a, b) ? 0 : min(min(dmSP(a, b.a), dmSP(a, b.b)), min(dmSP(b, a.a), dmSP(b, a.b)));}

int main() {
  while (true) {
    int n;
    D r;
    cin >> n >> r;
    if (n == 0) break;
    Pol pol(n);
    rep (i, n) cin >> pol[i].X >> pol[i].Y;
    vector<L> s;
    rep (i, n) rep (j, 4) s.push_back((L){pol[i] + polar(r, j * PI / 2), at(pol, i + 1) + polar(r, j * PI / 2)});
    rep (i, n) rep (j, 4) s.push_back((L){pol[i] + polar(r, j * PI / 2), pol[i] + polar(r, (j + 1) * PI / 2)});
    vector<P> vp;
    vector<vector<int> > edge = sArr(s, vp);
    D res = 0;
    rep (i, edge.size()) if (sGP(pol, vp[i]) > 0) rep (j, edge[i].size()) {
	D dis = 1e9;
	rep (k, n) dis = min(dis, dmSS((L){pol[k], at(pol, k + 1)}, (L){vp[i], vp[edge[i][j]]}));
	if (sig(dis, r) < 0) continue;
	res += abs(vp[i] - vp[edge[i][j]]);
      }
    printf("%.12f\n", res / 2);
  }
  return 0;
}

Measured memory_bytes: 1580