#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int N = 2000;
int n;
double r, x[N], y[N];
double f(double x) { return x * x; }
int main() {
  n = read();
  scanf("%lf", &r);
  scanf("%lf", &x[1]);
  y[1] = r;
  for (int i = (2); i <= (n); i++) {
    scanf("%lf", &x[i]);
    y[i] = r;
    for (int j = (1); j <= (i - 1); j++) {
      if (fabs(x[j] - x[i]) - 2 * r <= 1e-6) {
        if (sqrt(4 * r * r - f(x[i] - x[j])) + y[j] - y[i] > 1e-6)
          y[i] = sqrt(4 * r * r - f(x[i] - x[j])) + y[j];
      }
    }
  }
  for (int i = (1); i <= (n); i++) printf("%.10lf ", y[i]);
  return 0;
}
