#include <bits/stdc++.h>
using namespace std;
int i, j, m, n;
long long r, x[1005];
double y[1005];
double getmax(double a, double b) {
  if (a > b)
    return a;
  else
    return b;
}
double abss(double a) {
  if (a > 0)
    return a;
  else
    return (-a);
}
int main() {
  scanf("%d%lld", &n, &r);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &x[i]);
  }
  for (i = 1; i <= n; i++) {
    y[i] = r;
    for (j = 1; j <= i - 1; j++) {
      if (abss(x[i] - x[j]) <= r * 2) {
        y[i] = getmax(y[i],
                      y[j] + sqrt(r * r * 4 - (x[i] - x[j]) * (x[i] - x[j])));
      }
    }
  }
  for (i = 1; i <= n; i++) {
    printf("%.7lf ", y[i]);
  }
  printf("\n");
  return 0;
}
