#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int n, r, a[maxn];
double h[maxn];
int main() {
  scanf("%d%d", &n, &r);
  int r2 = r << 1;
  for (int i = 1; i <= n; ++i) {
    double mx = 0;
    scanf("%d", a + i);
    for (int j = 1; j < i; ++j) {
      if (r2 >= abs(a[i] - a[j])) {
        mx =
            max(sqrt(1. * (r2 * r2 - (a[i] - a[j]) * (a[i] - a[j]))) + h[j] - r,
                mx);
      }
    }
    h[i] = mx + r;
  }
  for (int i = 1; i <= n; ++i) {
    printf("%.12f%c", h[i], " \n"[i == n]);
  }
  return 0;
}
