#include<iostream>
#include<complex>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

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

typedef complex<double> P;
typedef pair<P, P> L;
typedef vector<P> Pol;

const double INF = 1e40;
const double EPS = 1e-6;
const double PI = acos(-1);

int sig(double r) {return (r < -EPS) ? -1 : (r > EPS) ? 1: 0;}
bool eq(double a, double b) {return abs(a - b) < EPS;}
bool near(P a, P b) {return abs(b - a) < EPS;}

// ツ禿?静?
double dot(P a, P b) {return a.X * b.X + a.Y * b.Y;}
// ツ外ツ静?
double cross(P a, P b) {return a.X * b.Y - a.Y * b.X;}

// ツ静シツ閉ェツづ個ベツクツトツδ?
P vec(L a) {return a.second - a.first;}

// ツ静シツ閉ェabツづ可妥篠つキツづゥツ点xツづ個暗環置
enum CCW{FRONT = 1, RIGHT = 2, BACK = 4, LEFT = 8, ON = 16};
int ccw(L s, P p) {
  P a = vec(s);
  p -= s.first;
  double cr = cross(a, p);
  if (eq(cr, 0)) {
    if (sig(dot(a, p)) < 0) return BACK;
    if (sig(norm(a) - norm(p)) < 0) return FRONT;
    return ON;
  }
  return (cr > 0) ? LEFT : RIGHT;
}

// ツ角ツ度
double ang(P p) {double theta = arg(p); return sig(theta - PI) < 0 ? theta : -PI;}
// ツ有ツ古シツ角ツ度
double ang(P base, P a, P b) {return ang((b - base) / (a - base));}
P dv(double theta) {return polar(1., theta);}

// ツ古ーツ債キツ板サツ津ィ
bool iLL(L a, L b) {return !eq(cross(vec(a), vec(b)), 0);}
bool eqL(L a, L b) {return !iLL(a, b) && eq(cross(vec(a), b.first - a.first), 0);}
bool iLS(L a, L b) {return sig(cross(vec(a), b.first - a.first)) * sig(cross(vec(a), b.second - a.first)) <= 0;}
bool iLSs(L a, L b) {return sig(cross(vec(a), b.first - a.first)) * sig(cross(vec(a), b.second - a.first)) < 0;}
bool iSS(L a, L b) {
  int cwa = ccw(a, b.first) | ccw(a, b.second);
  int cwb = ccw(b, a.first) | ccw(b, a.second);
  if ((cwa | cwb) & ON) return true;
  return (cwa & cwb) == (LEFT | RIGHT);
}
bool iSSs(L a, L b) {
  return ((ccw(a, b.first) | ccw(a, b.second)) & (ccw(b, a.first) | ccw(b, a.second))) == (LEFT | RIGHT);
}

// ツ古ーツ点
P pLL(L a, L b) {return a.first + vec(a) * (cross(vec(b), b.first - a.first) / cross(vec(b), vec(a)));}

// xツ催?標ツづ?ソツーツト
bool lessX(P a, P b){
  if(!eq(a.X, b.X)) return a.X < b.X;
  if(!eq(a.Y, b.Y)) return a.Y < b.Y;
  return false;
}

// ツ堕スツ角ツ形ツづ個禿?外ツ板サツ津ィ ツ禿?閉?1ツ、ツ偲シツ湘」:0ツ、ツ外ツ閉?-1
int sGP(Pol pol, P p) {
  int side = -1;
  rep (i, pol.size()) {
    P p0 = pol[i] - p, p1 = pol[(i + 1) % pol.size()] - p;
    if (sig(cross(p0, p1)) == 0 && sig(dot(p0, p1)) <= 0) return 0;
    if (p0.Y > p1.Y) swap(p0, p1);
    if (sig(p0.Y) <= 0 && 0 < sig(p1.Y) && sig(cross(p0, p1)) > 0) side *= -1;
  }
  return side;
}

// ツ静シツ閉ェツアツδ個δ督ジツδ?δ督ト ツ療猟づ個点ツづ鳴づ個陛督づ個づ敖づーツ篠敖づ?
pair<vector<P>, vector<vector<int> > > sArr(vector<L> s) {
  vector<L> segs;
  bool update = true;
  while (update) {
    update = false;
    rep (i, s.size()) {
      bool ok = true;
      rep (j, segs.size()) {
	if (iSS(s[i], segs[j]) && eq(cross(vec(s[i]), vec(segs[j])), 0)) {
	  vector<P> v;
	  v.push_back(s[i].first);
	  v.push_back(s[i].second);
	  v.push_back(segs[j].first);
	  v.push_back(segs[j].second);
	  sort(v.begin(), v.end(), lessX);
	  segs[j] = L(v[0], v[3]);
	  ok = false;
	  update = true;
	  break;
	}
      }
      if (ok) segs.push_back(s[i]);
    }
    s = segs;
    segs.clear();
  }

  vector<P> vp;
  rep (i, s.size()) {
    vp.push_back(s[i].first);
    vp.push_back(s[i].second);
  }
  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(), lessX);
  vp.erase(unique(vp.begin(), vp.end(), near), vp.end());
  vector<vector<int> > g(vp.size());
  rep (i, s.size()) {
    vector<pair<double, int> > v;
    rep (j, vp.size()) if (ccw(s[i], vp[j]) == ON) {
      v.push_back(make_pair(norm(vp[j] - s[i].first), 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 make_pair(vp, g);
}

double dmPP(P a, P b) {return abs(a.X - b.X) + abs(a.Y - b.Y);}
double dmSP(L s, P p) {
  double res = min(dmPP(s.first, p), dmPP(s.second, p));
  L l = L(p, p + P(1, 0));
  if (iLS(l, s) && !eq(cross(vec(l), vec(s)), 0)) {
    P pp = pLL(l, s);
    res = min(res, dmPP(p, pp));
  }
  l = L(p, p + P(0, 1));
  if (iLS(l, s) && !eq(cross(vec(l), vec(s)), 0)) {
    P pp = pLL(l, s);
    res = min(res, dmPP(p, pp));
  }
  return res;
}
double dmSS(L a, L b) {return iSS(a, b) ? 0 : min(min(dmSP(a, b.first), dmSP(a, b.second)), min(dmSP(b, a.first), dmSP(b, a.second)));}

pair<vector<P>, vector<vector<int> > > arr;

int main() {
  int n, r;
  for (int iii = 0;; ++iii) {
    cin >> n >> r;
    if (n == 0 && r == 0) break;
    Pol pol;
    rep (i, n) {
      P p;
      cin >> p.X >> p.Y;
      pol.push_back(p);
    }
    vector<L> segs;
    rep (i, n) {
      segs.push_back(L(pol[i] + P(r, 0), pol[(i + 1) % n] + P(r, 0)));
      segs.push_back(L(pol[i] + P(0, r), pol[(i + 1) % n] + P(0, r)));
      segs.push_back(L(pol[i] + P(-r, 0), pol[(i + 1) % n] + P(-r, 0)));
      segs.push_back(L(pol[i] + P(0, -r), pol[(i + 1) % n] + P(0, -r)));
      segs.push_back(L(pol[i] + P(r, 0), pol[i] + P(0, r)));
      segs.push_back(L(pol[i] + P(0, r), pol[i] + P(-r, 0)));
      segs.push_back(L(pol[i] + P(-r, 0), pol[i] + P(0, -r)));
      segs.push_back(L(pol[i] + P(0, -r), pol[i] + P(r, 0)));
    }
    arr = sArr(segs);
    int m = arr.first.size();
    double res = 0;
    rep (i, m) {
      if (sGP(pol, arr.first[i]) <= 0) continue;
      rep (j, arr.second[i].size()) {
	bool ok = true;
	rep (k, n) {
	  if (sig(dmSS(L(pol[k], pol[(k + 1) % n]), L(arr.first[i], arr.first[arr.second[i][j]])) - r) < 0) {
	    ok = false;
	    break;
	  }
	}
	if (ok) res += abs(arr.first[i] - arr.first[arr.second[i][j]]);
      }
    }
    printf("%.10lf\n", res / 2);
  }
  return 0;
}

Measured memory_bytes: 1484