#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream& operator<<(ostream& out, const pair<A, B>& p) {
  out << "( " << p.first << ", " << p.second << " )";
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[ ";
  for (auto it : v) out << it << " ";
  out << "]";
  return out;
}
int x[1010];
double c[1010];
double ans[1010];
int main() {
  int n, r;
  cin >> n >> r;
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
  }
  fill(c, c + 1010, r);
  double fd = 2 * r;
  for (int i = 0; i < n; ++i) {
    ans[i] = c[x[i]];
    int lb = max(x[i] - 2 * r, 1);
    int rb = min(x[i] + 2 * r, 1000);
    for (int j = lb; j <= rb; ++j) {
      double dx = abs(x[i] - j);
      double dy = sqrt(fd * fd - dx * dx);
      c[j] = max(c[j], dy + ans[i]);
    }
  }
  for (int i = 0; i < n; ++i) printf("%6f ", ans[i]);
  printf("\n");
  return 0;
}
