#include <bits/stdc++.h>
using namespace std;
double r;
bool cek(double x2, double y2, double x1, double y1) {
  double lhs = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1), rhs = 4 * r * r;
  return (lhs - rhs <= 0);
}
int main() {
  int n;
  cin >> n >> r;
  pair<double, double> ans[n];
  for (int tmp = 0; tmp < n; tmp++) {
    double x2;
    cin >> x2;
    double mn = r;
    for (int temp = 0; temp < tmp; temp++) {
      double x1 = ans[temp].first, y1 = ans[temp].second;
      double lhs = (x2 - x1) * (x2 - x1) + (y1 - y1) * (y1 - y1),
             rhs = 4 * r * r;
      if (!cek(x2, y1, x1, y1))
        continue;
      else {
        double left = y1, right = 10e8;
        for (int t = 0; t < 100; t++) {
          double mid = (left + right) / 2;
          if (cek(x2, mid, x1, y1))
            left = mid;
          else
            right = mid;
        }
        mn = max(mn, left);
      }
    }
    ans[tmp] = {x2, mn};
  }
  cout << fixed;
  cout << setprecision(11);
  cout << ans[0].second;
  for (int temp = 1; temp < n; temp++) cout << " " << ans[temp].second;
  cout << "\n";
}
