#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, i = 0, j, k, x, y, z, count = 0, p, flag = 0, ans = 0, sum = 0,
               l, n, m, max1, min1, pos, tmp, q;
  t = 1;
  while (t--) {
    long long n, r;
    scanf("%lld%lld", &n, &r);
    long double x[1005], y[1005];
    for (i = 0; i < n; i++) {
      scanf("%Lf", &x[i]);
    }
    for (i = 0; i < n; i++) {
      y[i] = -1.0 * 1000000000;
      for (j = 0; j < i; j++) {
        double p = abs(x[i] - x[j]);
        if (p <= 2 * r) {
          double q = y[j] + sqrtl(4 * r * r - p * p);
          if (q > y[i]) y[i] = q;
        }
      }
      if (y[i] == -1.0 * 1000000000) y[i] = 1.0 * r;
      printf("%.15Lf ", y[i]);
    }
  }
  return 0;
}
