#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T qmin(const T &a, const T &b) {
  return a < b ? a : b;
}
template <typename T>
inline T qmax(const T &a, const T &b) {
  return a > b ? a : b;
}
template <typename T>
inline void getmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <typename T>
inline void getmax(T &a, const T &b) {
  if (a < b) a = b;
}
inline void fileio(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const int inf = (int)1e9 + 7;
const long long linf = (long long)1e17 + 7;
const int N = 1005;
int x[N], r, n;
double y[N];
int main() {
  scanf("%d%d", &n, &r);
  for (register int i = (1); i <= (n); ++i) {
    scanf("%d", x + i);
    y[i] = r;
    for (register int j = (1); j <= (i - 1); ++j) {
      if (((x[i] - x[j]) < 0 ? -(x[i] - x[j]) : (x[i] - x[j])) > 2 * r)
        continue;
      getmax(y[i], y[j] + sqrt((double)4.00 * r * r -
                               (double)(x[i] - x[j]) * (x[i] - x[j])));
    }
  }
  for (register int i = (1); i <= (n); ++i) printf("%.10f ", y[i]);
  puts("");
  return 0;
}
