#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long linf = 1ll * inf * inf;
const int N = 2000 + 7;
const int M = 22;
const int multipleTest = 0;
int n, r;
int x[N];
double y[N];
int id[N];
double sqr(double a) { return a * a; }
double giao(int i, int j) {
  if (x[j] - r > x[i] + r || x[j] + r < x[i] - r) return -1;
  return sqrt(sqr(2 * r) - sqr(x[i] - x[j])) + y[i];
}
void solve() {
  cin >> n >> r;
  for (int i = 0; i < n; ++i) {
    scanf("%d", x + i);
    double mx = -1;
    for (int j = 0; j < i; ++j) mx = max(mx, giao(j, i));
    if (mx < 0) {
      y[i] = r;
    } else {
      y[i] = mx;
    }
  }
  for (int i = 0; i < n; ++i) printf("%.6lf ", y[i]);
}
int main() {
  int Test = 1;
  if (multipleTest) cin >> Test;
  for (int i = 0; i < Test; ++i) {
    solve();
  }
}
