#include <bits/stdc++.h>
using namespace std;
double pos[1001];
int main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, R;
  cin >> n >> R;
  for (int i = 0; i <= 1000; i++) pos[i] = R;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    cout << setprecision(15) << pos[x] << ' ';
    for (int dx = 1; dx <= 2 * R; dx++) {
      const double dy = sqrt(pow(R, 2) * 4 - dx * dx);
      if (x - dx >= 0) pos[x - dx] = max(pos[x - dx], pos[x] + dy);
      if (x + dx <= 1000) pos[x + dx] = max(pos[x + dx], pos[x] + dy);
    }
    pos[x] += 2 * R;
  }
  return 0;
}
