#include <bits/stdc++.h>
using namespace std;
const int maxm = 1010;
const double eps = 1e-7;
int n, r, arr[maxm];
double rec[maxm];
bool intersect(int i, int j), equals(double a, double b);
int main() {
  cout.setf(ios::fixed);
  cout.precision(10);
  ios_base::sync_with_stdio(0);
  cin >> n >> r;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  rec[0] = r;
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < i; ++j)
      if (intersect(i, j))
        rec[i] = max(
            rec[i],
            rec[j] +
                (r << 1) *
                    sqrt(1 - pow((abs(arr[i] - arr[j]) * 1.0 / (r << 1)), 2)));
    if (equals(rec[i], 0)) rec[i] = r;
  }
  for (int i = 0; i < n; ++i) cout << rec[i] << ' ';
  cout << endl;
  return 0;
}
bool intersect(int i, int j) { return abs(arr[i] - arr[j]) <= (r << 1); }
bool equals(double a, double b) { return abs(a - b) < eps; }
