#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, r;
  cin >> n >> r;
  double arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  double arrY[n];
  double test[n];
  arrY[0] = r;
  test[0] = r;
  for (int i = 1; i < n; i++) {
    int indx = -1;
    double maxe = -1;
    double xmax = 1;
    int j;
    for (j = i - 1; j > -1; j--) {
      if (arr[i] <= arr[j]) {
        if ((arr[j] - r) - (arr[i] + r) <= 0) {
          double x, y;
          x = arr[j];
          y = arrY[j];
          double x2 = arr[i], y2;
          double a = 1, b = -1 * 2 * y, c = pow(x2 - x, 2) + y * y - 4 * r * r;
          double ans1, ans2;
          double root = sqrt(b * b - 4 * a * c);
          ans1 = (-1 * b + root) / 2;
          if (ans1 > maxe) {
            maxe = ans1;
          }
        }
      } else if (arr[i] >= arr[j]) {
        if ((arr[i] - r) - (arr[j] + r) <= 0) {
          double x, y;
          x = arr[j];
          y = arrY[j];
          double x2 = arr[i], y2;
          double a = 1, b = -1 * 2 * y, c = pow(x2 - x, 2) + y * y - 4 * r * r;
          double ans1, ans2;
          double root = sqrt(b * b - 4 * a * c);
          ans1 = (-1 * b + root) / 2;
          if (ans1 > maxe) {
            maxe = ans1;
          }
        }
      }
    }
    if (maxe == -1) {
      arrY[i] = r;
    } else {
      arrY[i] = maxe;
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%.12f ", arrY[i]);
  }
  return 0;
}
