import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.readInt();
            int r = in.readInt();
            int[] x = in.readIntArray(n);
            double[] y = new double[n];
            y[0] = r;
            for (int i = 1; i < n; i++) {
                double max = r;
                for (int j = 0; j < i; j++) {
                    double pow = Math.pow(x[i] - x[j], 2);
                    if (pow <= 4 * r * r) {
                        double ty = y[j] + Math.sqrt(4 * r * r - pow);
                        max = Math.max(max, ty);
                    }
                }
                y[i] = max;
            }
            for (double i : y) out.print(i + " ");

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] readIntArray(int size) {
            int[] ans = new int[size];
            for (int i = 0; i < size; i++) ans[i] = readInt();
            return ans;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


/*
 * code together
 * code better
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	static int x[]=new int[1005];
	static double ans[]=new double[1005];
	static int nn,r;
	public static void main(String[] args) throws IOException {
		StreamTokenizer in=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		Scanner sc=new Scanner(System.in);
		int huiwoqingchun=0;
		nn=sc.nextInt();
		r=sc.nextInt();
		for(int i=1;i<=nn;i++) {
			x[i]=sc.nextInt();
		}
		//HashMap<, V>
		ans[1]=r;
		int lajitimu=0;
		for(int i=2;i<=nn;i++) {
			ans[i]=r;
			for(int j=1;j<i;j++) {
				if(Math.abs(x[j]-x[i])>2*r)
					continue;
				ans[i]=Math.max(ans[i], ans[j]+Math.sqrt(4*r*r-(x[j]-x[i])*(x[j]-x[i])));
			}
		}
		double buzhidaoganma=0;
		for(int c=1;c<=nn;c++)
			System.out.printf("%.12f ",ans[c]);
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C908 solver = new C908();
        solver.solve(1, in, out);
        out.close();
    }

    static class C908 {
        int N;
        int R;
        int[] x;
        double[] ans;

        public void solve(int testNumber, FastScanner s, PrintWriter out) {

            N = s.nextInt();
            R = s.nextInt();
            x = s.nextIntArray(N);

            ans = new double[N];
            Arrays.fill(ans, R);

            for (int i = 0; i < N; i++) {
                // placing circle i
                for (int j = 0; j < i; j++) {
                    // testing collision with placed circles
                    if (Math.abs(x[i] - x[j]) <= 2 * R) {
                        // they will collide
                        // compute the increase in y that will be had
                        double dy = Math.sqrt(Math.pow(2 * R, 2) - Math.pow(x[i] - x[j], 2));
                        ans[i] = Math.max(ans[i], ans[j] + dy);
                    }
                }
            }

            for (double d : ans)
                out.print(d + " ");
            out.println();

        }

    }

    static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public int[] nextIntArray(int N) {
            int[] ret = new int[N];
            for (int i = 0; i < N; i++)
                ret[i] = this.nextInt();
            return ret;
        }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
public class naloga1{
	static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter out=new PrintWriter(System.out);
	public static void main(String[] args) throws Exception{
		StringTokenizer st=new StringTokenizer(in.readLine());
		int n=Integer.parseInt(st.nextToken());
		int r=Integer.parseInt(st.nextToken());
		int[] x=new int[n];
		st=new StringTokenizer(in.readLine());
		for(int i=0;i < n;i++){
			x[i]=Integer.parseInt(st.nextToken());
		}
		sim a=new sim(n,r);
		for(int i:x) {
			a.add(i);
		}
		for(double d:a.cy) {
			out.print(d+" ");
		}
		out.println();
		out.close();
	}
}
class sim{
	double[]cx;
	int[]ccx;
	double[]cy;
	int count;
	int n;
	int r;
	sim(int nn,int rr){
		r=rr;
		n=nn;
		cx=new double[n];
		ccx=new int[n];
		cy=new double[n];
		count=0;
	}
	void add(int x) {
		double lowest=r;
		for(int i=0;i<count;i++) {
			if(Math.abs(ccx[i]-x)<=2*r) {
				double dy=Math.sqrt(4*r*r-(ccx[i]-x)*(ccx[i]-x));
				lowest=Math.max(lowest,cy[i]+dy);
			}
		}
		ccx[count]=x;
		cy[count]=lowest;
		cx[count++]=x;
	}
}


import java.io.*;
import java.util.*;

public class ProblemA {
	public static void main(String[] args) throws Exception{
			BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
			StringTokenizer st = new StringTokenizer(bf.readLine());
			StringTokenizer st1 = new StringTokenizer(bf.readLine());
			int n = Integer.parseInt(st.nextToken());
			int r = Integer.parseInt(st.nextToken());
			int[] xcoords = new int[n];
			for(int i = 0;i<n;i++){
				xcoords[i] = Integer.parseInt(st1.nextToken());
			}
			double[] ycoords = new double[n];

			for(int i = 0;i<n;i++){
				ArrayList<Integer> nodes = new ArrayList<Integer>();
				for(int j = 0;j<i;j++){
					if (Math.abs(xcoords[j] - xcoords[i]+0.0) <= 2*r)
						nodes.add(j);
				}
				if (nodes.isEmpty()){
					ycoords[i] = r;
					continue;
				}
				else{
					double min = -1;
					for(int k = 0;k<nodes.size();k++){
						double tmp = ycoords[nodes.get(k)] + Math.sqrt(4*r*r - (xcoords[i] - xcoords[nodes.get(k)])*(xcoords[i] - xcoords[nodes.get(k)]));
						if (tmp > min){
							min = tmp;
						}
					}
					ycoords[i] = min;
				}
			}
			for(int i = 0;i<ycoords.length;i++){
				System.out.print(ycoords[i] + " ");
			}

	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class C {

    public static void main(String[] args) {

        MyScanner in = new MyScanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int r = in.nextInt();

        double[] y = new double[n];
        int[] x = new int[n];

        for(int i=0;i<n;++i){
            x[i] = in.nextInt();
            double bestY = r;
            for(int j=0;j<i;++j){
                if(Math.abs(x[i]-x[j]) <= 2*r){
                    double ny = y[j] + Math.sqrt(4*r*r - (x[i]-x[j])*(x[i]-x[j]));
                    if(ny > bestY){
                        bestY = ny;
                    }
                }
            }
            y[i] = bestY;
        }

        for(int i=0;i<n;++i){
            out.println(y[i]);
        }

        out.close();

    }

    // -----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    // --------------------------------------------------------

}


import java.util.*;
import java.io.*;

public class Solution2 {

    private void solve() throws IOException {
        int n = in.nextInt();
        double r = in.nextDouble();
        List<Double> xes = new ArrayList<>(n);
        List<Double> yes = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            xes.add(in.nextDouble());
        }
        for (int i = 0; i < n; i++) {
            double max = r;
            for (int j = 0; j < i; j++) {
                double x = xes.get(j);
                double y = yes.get(j);
                if (xes.get(i) <= x + 2 * r && xes.get(i) >= x - 2 * r) {
                    max = Math.max(max, y + Math.sqrt(4 * r * r - Math.abs(x - xes.get(i))* Math.abs(x - xes.get(i))));
                }
            }
            yes.add(max);
        }
        for (double y : yes) {
            System.out.print(y + " ");
        }
        System.out.println();
        System.out.flush();
    }

    private static String filename = "";
    private PrintWriter out;
    private MyScanner in;

    private void run() throws IOException {
        in = new MyScanner();
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    private class MyScanner {
        private BufferedReader br;
        private StringTokenizer st;

        MyScanner() throws IOException {
            this.br = new BufferedReader(new InputStreamReader(System.in));
        }

        public MyScanner(String fileTitle) throws IOException {
            this.br = new BufferedReader(new FileReader(fileTitle));
        }

        public String nextLine() throws IOException {
            String s = br.readLine();
            return s == null ? "-1" : s;
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                String s = br.readLine();
                if (s == null) {
                    return "-1";
                }
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        public Integer nextInt() throws IOException {
            return Integer.parseInt(this.next());
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(this.next());
        }

        public Double nextDouble() throws IOException {
            return Double.parseDouble(this.next());
        }

        void close() throws IOException {
            this.br.close();
        }
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Solution2().run();
    }
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class C {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = sc.nextInt();
		int r = sc.nextInt();

		double ans[] = new double[n];

		int[] x = new int[n];

		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
		}

		for (int i = 0; i < n; i++) {
			ans[i] = r;
			for (int j = 0; j < i; j++) {
				int d = Math.abs(x[i] - x[j]);
				if(d <= 2 * r) {
					ans[i] = Math.max(ans[i], ans[j] + Math.sqrt(4 * r * r - d * d));
				}
			}

			out.print(ans[i] + " ");
		}
		out.println();

		out.flush();
		out.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;

public class C {

	public static void main(String[] args) {
		FastScanner in = new FastScanner();
		int n = in.nextInt();
		double r = in.nextInt();
		double x[] = new double[n];
		for(int i = 0; i < n; i++)
			x[i] = in.nextDouble();

		double y[] = new double[n];
		y[0] = r;

		for(int i = 1; i < n; i++){
			double miny = r;
			for(int j = 0; j < i; j++){
				double dx = Math.abs(x[i]-x[j]);
				if(dx > r*2) continue;
				double yy = Math.sqrt(4*r*r-dx*dx);
				miny = Math.max(miny, yy+y[j]);
			}
			y[i] = miny;
		}
		for(int i = 0; i < n; i++){
			System.out.print(y[i]+" ");
		}

	}

	static class FastScanner{
		BufferedReader br;
		StringTokenizer st;
		public FastScanner(String s) {
			try{
				br = new BufferedReader(new FileReader(s));
			}
			catch(FileNotFoundException e) {
				e.printStackTrace();
			}
		}
		public FastScanner(){
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken()	{
			while(st == null ||!st.hasMoreElements()){
				try {
				st = new StringTokenizer(br.readLine());}
				catch(IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}
		long nextLong() {
			return Long.parseLong(nextToken());
		}
		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
		String next() {
			return nextToken();
		}

	}
}


import java.util.*;
import java.io.*;

public class test {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);
		StringTokenizer st = new StringTokenizer(s.nextLine());
		int n = Integer.parseInt(st.nextToken());
		int r = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(s.nextLine());
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = Integer.parseInt(st.nextToken());
		}
		ArrayList<State> list = new ArrayList<State>();
		for (int i = 0; i < n; i++) {
			double currY = r;
			for (int j = 0; j < list.size(); j++) {
				double xDiff = Math.abs(list.get(j).getX() - array[i]);
				if (xDiff <= 2 * r) {
					if (currY < list.get(j).getY() + Math.sqrt(4 * r * r - xDiff * xDiff)) {
						currY = list.get(j).getY() + Math.sqrt(4 * r * r - xDiff * xDiff);
					}
				}
			}
			list.add(new State(array[i], currY));
			System.out.print(currY + " ");
		}
		s.close();
	}

	static class State {
		double x;
		double y;

		public State(double a, double b) {
			x = a;
			y = b;
		}

		public double getX() {
			return x;
		}

		public double getY() {
			return y;
		}
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int r = in.nextInt();
			int[] x = new int[n];
			for (int i = 0; i < n; i++) {
				x[i] = in.nextInt();
			}
			double res = 0;
			double[] y = new double[n];

			for (int i = 0; i < n; i++) {
				double curY = r;
				for (int j = 0; j < i; j++) {
					int d = Math.abs(x[i] - x[j]);
					if (d <= 2 * r) {
						int a2 = 4 * r * r - d * d;
						curY = Math.max(curY, y[j] + Math.sqrt(a2));
					}
				}
				y[i] = curY;
				out.printf("%.14f", y[i]);
				if (i < n - 1) {
					out.print(" ");
				} else {
					out.println();
				}
			}
		}

	}

	static class InputReader {
		final InputStream is;
		final byte[] buf = new byte[1024];
		int pos;
		int size;

		public InputReader(InputStream is) {
			this.is = is;
		}

		public int nextInt() {
			int c = read();
			while (isWhitespace(c))
				c = read();
			int sign = 1;
			if (c == '-') {
				sign = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = read();
			} while (!isWhitespace(c));
			return res * sign;
		}

		int read() {
			if (size == -1)
				throw new InputMismatchException();
			if (pos >= size) {
				pos = 0;
				try {
					size = is.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (size <= 0)
					return -1;
			}
			return buf[pos++] & 255;
		}

		static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C {

	public static void main(String[] args){
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = scan.nextInt(), r = scan.nextInt();
		int[] x = scan.nextIntArray(n);
		double[] y = new double[n];
		for(int i = 0; i < n; i++) {
			double best = 0;
			for(int j = 0; j < i; j++) {
				if(Math.abs(dist(x[i], y[j], x[j], y[j])-2*r) <= 1e-7) {
					best = Math.max(best, y[j]);
					continue;
				}
				double lo = y[j]-r-r, hi = y[j]+r+r;
				for(int bs = 0; bs < 200; bs++) {
					double mid = (lo+hi)/2.0;
					if(dist(x[i], mid, x[j], y[j])-2*r <= 1e-7) lo = mid;
					else hi = mid;
				}
				if(dist(x[i], lo, x[j], y[j])-2*r <= 1e-7) best = Math.max(best, lo);
			}
			if(best == 0) y[i] = r;
			else y[i] = best;
		}
		for(int i = 0; i < n; i++) out.printf("%.6f ", y[i]);
		out.close();
	}

	static double dist(double x, double y, double xx, double yy) {return Math.sqrt((x-xx)*(x-xx)+(y-yy)*(y-yy));}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

		public int nextInt() {return Integer.parseInt(next());}

		public long nextLong() {return Long.parseLong(next());}

		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.Reader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyInput in = new MyInput(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, MyInput in, PrintWriter out) {
            int n = in.nextInt();
            int r = in.nextInt();
            int[] x = in.nextIntArray(n);
            double[] py = new double[n];
            for (int i = 0; i < n; i++) {
                double y = r;
                for (int j = 0; j < i; j++) {
                    int dx = Math.abs(x[i] - x[j]);
                    if (dx > 2 * r) continue;
                    y = Math.max(y, Math.sqrt(4 * r * r - dx * dx) + py[j]);
                }
                py[i] = y;
            }
            for (int i = 0; i < n; i++) {
                out.printf("%.10f%s", py[i], i == n - 1 ? "\n" : " ");
            }
        }

    }

    static class MyInput {
        private final BufferedReader in;
        private static int pos;
        private static int readLen;
        private static final char[] buffer = new char[1024 * 8];
        private static char[] str = new char[500 * 8 * 2];
        private static boolean[] isDigit = new boolean[256];
        private static boolean[] isSpace = new boolean[256];
        private static boolean[] isLineSep = new boolean[256];

        static {
            for (int i = 0; i < 10; i++) {
                isDigit['0' + i] = true;
            }
            isDigit['-'] = true;
            isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
            isLineSep['\r'] = isLineSep['\n'] = true;
        }

        public MyInput(InputStream is) {
            in = new BufferedReader(new InputStreamReader(is));
        }

        public int read() {
            if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new MyInput.EndOfFileRuntimeException();
                }
            }
            return buffer[pos++];
        }

        public int nextInt() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            int ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++) ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public char nextChar() {
            while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            }
        }

        int reads(int len, boolean[] accept) {
            try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (MyInput.EndOfFileRuntimeException e) {
            }
            return len;
        }

        public int[] nextIntArray(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        static class EndOfFileRuntimeException extends RuntimeException {
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.readInt();
            int r = in.readInt();
            int[] x = IOUtils.readIntArray(in, n);
            double[] y = new double[n];
            for (int idx = 0; idx < x.length; idx++) {
                double yRes = r;
                for (int prev = 0; prev < idx; prev++) {
                    int xDelta = Math.abs(x[idx] - x[prev]);
                    if (xDelta <= 2 * r) {
                        // then we intersect with prev
                        double yDelta = calcDelta(xDelta, r);
                        yRes = Math.max(yRes, y[prev] + yDelta);
                    }
                }
                y[idx] = yRes;
            }
            out.printLine(y);
        }

        private double calcDelta(int xDelta, int r) {
            return Math.sqrt(4 * r * r - xDelta * xDelta);
        }
    }
    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(double[] array) {
            for (int i = 0; i < array.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(array[i]);
            }
        }

        public void printLine(double[] array) {
            print(array);
            writer.println();
        }

        public void close() {
            writer.close();
        }
    }
    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}


import java.util.Scanner;

/**
 *
 * @author msagimbekov
 */
public class Codeforces908C {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sc.nextInt();
        int[] x = new int[n];
        double[] res = new double[n];
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextInt();
            res[i] = (double)r;
            for (int j = i - 1; j >= 0; j--) {
                int diff = x[j] - x[i];
                if (Math.abs(x[j] - x[i]) <= 2 * r) {
                    res[i] = Math.max(res[i], res[j] + Math.sqrt(4 * r * r - diff * diff));
                }
            }
        }

        for (int i = 0; i < n; i++) {
            System.out.print(res[i] + " ");
        }
        System.out.println("");
    }
}


import java.io.*;
import java.util.StringTokenizer;

public class NewYearCurling908C {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        int n = in.nextInt();

        double r = (double) in.nextInt();
        double[] answers = new double[n];
        double[] xCoords = new double[n];
        for (int i = 0; i < n; i++) xCoords[i] = (double) in.nextInt();

        answers[0] = r;
        for (int i = 1; i < n; i++) {
            double bound = r;
            for (int j = 0; j < i; j++) {
                double xDif = xCoords[i] - xCoords[j];
                double y = answers[j];
                double yNew = y + Math.sqrt(4 * r * r - xDif * xDif);
                if (yNew > bound) bound = yNew;
            }
            answers[i] = bound;
        }
        for (int i = 0; i < n; i++) System.out.print(answers[i] + " ");
        System.out.println();
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


import java.util.*;
import java.io.*;

public class ProblemD
{

    static int mod = (int) (1e9+7);
    static InputReader in;
    static PrintWriter out;

    static void solve()
    {
        in = new InputReader(System.in);
        out = new PrintWriter(System.out);

        int n = in.nextInt();
        int r = in.nextInt();
        double[] x = new double[n];
        double[] y = new double[n];

        for(int i = 0; i < n; i++){
            int xx = in.nextInt();
            x[i] = xx;
            y[i] = r;
            for(int j = 0; j < i; j++){
                double delx = Math.abs(x[i] - x[j]);
                //debug(delx);
                if(delx <= 2 * r){
                    double tmp = 4 * r * r - delx * delx;
                    tmp = Math.sqrt(tmp);
                    tmp = y[j] + tmp;
                    y[i] = Math.max(y[i], tmp);
                }
            }
            out.print(y[i] + " ");
        }

        out.close();
    }

    public static void main(String[] args)
    {
        new Thread(null ,new Runnable(){
            public void run(){
                try{
                    solve();
                } catch(Exception e){
                    e.printStackTrace();
                }
            }
        },"1",1<<26).start();

    }

    static class Pair implements Comparable<Pair>
    {

        long x,y;

        Pair (long x,long y)
        {
                this.x = x;
                this.y = y;
        }
        public int compareTo(Pair o)
        {
            return Long.compare(this.x,o.x);
                //return 0;
        }

        public boolean equals(Object o)
        {
            if (o instanceof Pair)
            {
                Pair p = (Pair)o;
                return p.x == x && p.y==y;
            }
            return false;
        }

        @Override
        public String toString()
        {
            return x + " "+ y ;
        }

        /*public int hashCode()
        {
            return new Long(x).hashCode() * 31 + new Long(y).hashCode();
        }*/

    }

    static long add(long a,long b){
        long x=(a+b);
        while(x>=mod) x-=mod;
        return x;
    }

    static long sub(long a,long b){
        long x=(a-b);
        while(x<0) x+=mod;
        return x;
    }

    static long mul(long a,long b){
        long x=(a*b);
        while(x>=mod) x-=mod;
        return x;
    }

    static String rev(String s){
        StringBuilder sb=new StringBuilder(s);
        sb.reverse();
        return sb.toString();
    }

    static long gcd(long x,long y)
    {
        if(y==0)
                return x;
        else
                return gcd(y,x%y);
    }

    static int gcd(int x,int y)
    {
        if(y==0)
                return x;
        else
                return gcd(y,x%y);
    }

    static long pow(long n,long p,long m)
    {
         long  result = 1;
          if(p==0){
            return 1;
          }

        while(p!=0)
        {
            if(p%2==1)
                result *= n;
            if(result >= m)
               result %= m;
            p >>=1;
            n*=n;
            if(n >= m)
                n%=m;
        }

        return result;
    }

    static long pow(long n,long p)
    {
        long  result = 1;
          if(p==0)
            return 1;

        while(p!=0)
        {
            if(p%2==1)
                result *= n;
            p >>=1;
            n*=n;
        }
        return result;
    }

    static void debug(Object... o)
    {
            System.out.println(Arrays.deepToString(o));
    }

    static class InputReader
    {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
                this.stream = stream;
        }

        public int snext()
        {
                if (snumChars == -1)
                        throw new InputMismatchException();
                if (curChar >= snumChars)
                {
                        curChar = 0;
                        try
                        {
                                snumChars = stream.read(buf);
                        } catch (IOException e)
                        {
                                throw new InputMismatchException();
                        }
                        if (snumChars <= 0)
                                return -1;
                }
                return buf[curChar++];
        }

        public int nextInt()
        {
                int c = snext();
                while (isSpaceChar(c))
                {
                        c = snext();
                }
                int sgn = 1;
                if (c == '-')
                {
                        sgn = -1;
                        c = snext();
                }
                int res = 0;
                do
                {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = snext();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public long nextLong()
        {
                int c = snext();
                while (isSpaceChar(c))
                {
                        c = snext();
                }
                int sgn = 1;
                if (c == '-')
                {
                        sgn = -1;
                        c = snext();
                }
                long res = 0;
                do
                {
                        if (c < '0' || c > '9')
                                throw new InputMismatchException();
                        res *= 10;
                        res += c - '0';
                        c = snext();
                } while (!isSpaceChar(c));
                return res * sgn;
        }

        public int[] nextIntArray(int n)
        {
                int a[] = new int[n];
                for (int i = 0; i < n; i++)
                {
                        a[i] = nextInt();
                }
                return a;
        }

        public long[] nextLongArray(int n)
        {
                long a[] = new long[n];
                for (int i = 0; i < n; i++)
                {
                        a[i] = nextLong();
                }
                return a;
        }

        public String readString()
        {
                int c = snext();
                while (isSpaceChar(c))
                {
                        c = snext();
                }
                StringBuilder res = new StringBuilder();
                do
                {
                        res.appendCodePoint(c);
                        c = snext();
                } while (!isSpaceChar(c));
                return res.toString();
        }

        public String nextLine()
        {
                int c = snext();
                while (isSpaceChar(c))
                        c = snext();
                StringBuilder res = new StringBuilder();
                do
                {
                        res.appendCodePoint(c);
                        c = snext();
                } while (!isEndOfLine(c));
                return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
                if (filter != null)
                        return filter.isSpaceChar(c);
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c)
        {
                return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter
        {
                public boolean isSpaceChar(int ch);
        }

    }
}


/*
 *
 * @Author  Ajudiya_13(Bhargav Girdharbhai Ajudiya)
 * Dhirubhai Ambani Institute of Information And Communication Technology
 *
 */

import java.util.*;
import java.io.*;
import java.lang.*;

public class Code3
{

	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int n = in.nextInt();
		double r = (double)in.nextInt();
		double [] a = new double[n];
		for(int i=0;i<n;i++)
			a[i] = (double)in.nextInt();
		double[] ans = new double[n];
		ans[0] = r;

		for(int i=1;i<n;i++)
		{
			double max = Double.MIN_VALUE;
			for(int j=0;j<i;j++)
			{
				if(Math.abs(a[i]-a[j])<=2*r)
				{
					//System.out.println(j);
					double cur = 4*r*r;
					cur -= ((a[i]-a[j])*(a[i]-a[j]));
					cur = Math.sqrt(cur);
					cur += ans[j];
					//System.out.println(r);
					max = Math.max(max, cur);
				}
			}

			if(max == Double.MIN_VALUE)
				ans[i] = r;
			else
				ans[i] = max;
		}

		for(int i=0;i<n;i++)
			pw.print(ans[i] + " ");
		pw.flush();
		pw.close();
	}

	static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}

	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int n)
	{

	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (int i=5; i*i<=n; i=i+6)
	    {
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;
	    }

	    return true;
	}

	static class pair implements Comparable<pair>
	{
		Integer x, y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString()
		{
			return x+" "+y;
		}

		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return p.x == x && p.y == y ;
			}
			return false;
		}

		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		int d = 2 * r;
		int[] xCoordinates = new int[n];
		double[] yCoordinates = new double[n];
		for (int i = 0; i < n; i++)
			yCoordinates[i] = r;
		for (int i = 0; i < n; i++)
			xCoordinates[i] = sc.nextInt();
		double y = 0;
		for (int i = 0; i < n; i++) {
			y = r;
			for (int j = 0; j < i; j++) {
				if (Math.abs(xCoordinates[i] - xCoordinates[j]) <= 2 * r) {
					int dx = Math.abs(xCoordinates[i] - xCoordinates[j]);
					double dy = Math.sqrt(d * d - dx * dx);
					if (dy + yCoordinates[j] > y)
						y = dy + yCoordinates[j];
				}
			}
			yCoordinates[i]=y;
		}
		for (int i = 0; i < n; i++)
			System.out.print(yCoordinates[i] + " ");
		sc.close();
	}

}


import java.util.*;
import java.io.*;
public class C
{
   static long time = System.currentTimeMillis();
   public static void main(String[] args) throws IOException
   {
      //FastReader infile = new FastReader("test.txt");
      FastReader infile = new FastReader(System.in);
      int N = infile.nextInt();
      int R = infile.nextInt();
      double[] xPos = new double[N];
      for(int x = 0; x < N; x++)
         xPos[x] = infile.nextDouble();
      double[] yPos = new double[N];
      Arrays.fill(yPos, R);
      for(int x = 1; x < N; x++)
      {
         for(int y = 0; y < x; y++)
            if(Math.abs(xPos[x]-xPos[y])<=2*R)
            {
               yPos[x] = Math.max(yPos[x], yPos[y]+Math.sqrt((2*R)*(2*R)-Math.abs(xPos[x]-xPos[y])*Math.abs(xPos[x]-xPos[y])));
            }
      }
      System.out.print(yPos[0]);
      for(int x = 1; x < N; x++)
         System.out.print(" "+yPos[x]);
      //System.out.println(System.currentTimeMillis()-time);
   }
}
class FastReader
{
   BufferedReader br;
   StringTokenizer st;

   public FastReader(String file) throws IOException
   {
      br = new BufferedReader(new FileReader(file));
   }

   public FastReader(InputStream i) throws IOException
   {
      br = new BufferedReader(new InputStreamReader(System.in));
   }
   boolean hasNext()
   {
      while (st == null || !st.hasMoreElements())
      {
         try
         {
            st = new StringTokenizer(br.readLine());
         }
         catch (Exception  e)
         {
            return false;
         }
      }
      return true;
   }

   String next()
   {
      while (st == null || !st.hasMoreElements())
      {
         try
         {
            st = new StringTokenizer(br.readLine());
         }
         catch (IOException  e)
         {
            e.printStackTrace();
         }
      }
      return st.nextToken();
   }

   int nextInt()
   {
      return Integer.parseInt(next());
   }

   long nextLong()
   {
      return Long.parseLong(next());
   }

   double nextDouble()
   {
      return Double.parseDouble(next());
   }

   String nextLine()
   {
      String str = "";
      try
      {
         str = br.readLine();
      }
      catch (IOException e)
      {
         e.printStackTrace();
      }
      return str;
   }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author khokharnikunj8
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int r = in.scanInt(), temp;
            double max1;
            double high[] = new double[1002];
            for (int i = 0; i < n; i++) {
                temp = in.scanInt();
                max1 = high[temp] + ((high[temp] == 0) ? r : +(2 * r));
                for (int j = temp - 1; j > temp - (2 * r) && j > 0; j--) {
                    if (high[j] == 0) continue;
                    max1 = Math.max(max1, high[j] + Math.sqrt((4 * r * r) - ((temp - j) * (temp - j))));
                }
                for (int j = temp + 1; j <= 1000 && j < temp + (2 * r); j++) {
                    if (high[j] == 0) continue;
                    max1 = Math.max(max1, high[j] + Math.sqrt((4d * r * r) - (((j - temp) * (j - temp)))));
                }
                if (temp - (2 * r) > 0) max1 = Math.max(high[temp - (2 * r)], max1);
                if (temp + (2 * r) <= 1000) max1 = Math.max(high[temp + (2 * r)], max1);
                high[temp] = max1;
                out.print(max1 + " ");

            }
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}


import java.io.* ;
import java.util.* ;
import java.text.* ;
import java.math.* ;
import static java.lang.Math.min ;
import static java.lang.Math.max ;
import static java.lang.Math.sqrt ;
public class Codeshefcode{
	public static void main(String[] args) throws IOException{
		Solver Machine = new Solver() ;
		Machine.Solve() ;
		Machine.Finish() ;
		// new Thread(null,new Runnable(){
		// 	public void run(){
		// 		Solver Machine = new Solver() ;
		// 		try{
		// 			Machine.Solve() ;
		// 			Machine.Finish() ;
		// 		}catch(Exception e){
		// 			e.printStackTrace() ;
		// 			System.out.flush() ;
		// 			System.exit(-1) ;
		// 		}catch(Error e){
		// 			e.printStackTrace() ;
		// 			System.out.flush() ;
		// 			System.exit(-1) ;
		// 		}
		// 	}
		// },"Solver",1l<<27).start() ;
	}
}
class Mod{
	static long mod=1000000007 ;
	static long d(long a,long b){ return (a*MI(b))%mod ; }
	static long m(long a,long b){ return (a*b)%mod ; }
	static private long MI(long a){ return pow(a,mod-2) ; }
	static long pow(long a,long b){
		if(b<0) return pow(MI(a),-b) ;
		long val=a ; long ans=1 ;
		while(b!=0){
			if((b&1)==1) ans = (ans*val)%mod ;
			val = (val*val)%mod ;
			b/=2 ;
		}
		return ans ;
	}
}
class pair implements Comparable<pair>{
	int x ; int y ;
	pair(int x,int y){ this.x=x ; this.y=y ;}
	public int compareTo(pair p){
		return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ;
	}
}
class Solver{
	Reader ip = new Reader(System.in) ;
	PrintWriter op = new PrintWriter(System.out) ;
	public void Solve() throws IOException{
		int n = ip.i() ; int r = ip.i() ;
		double x[] = new double[n] ;
		double y[] = new double[n] ;
		for(int i=0 ; i<n ; i++) x[i] = ip.i() ;
		for(int i=0 ; i<n ; i++){
			double my = 0 ;
			for(int j=0 ; j<i ; j++)
				my = max(my,func(x[j],y[j],r,x[i])) ;
			y[i] = my ;
		}
		for(int i=0 ; i<n ; i++) p((y[i]+r)+" ") ;
		pln("") ;
	}
	double abd(double x,double y){
		return x>y ? x-y : y-x ;
	}
	double func(double x1,double y1,double r,double x2){
		if(abd(x1,x2)>(2*r)) return 0 ;
		if(abd(x1,x2)==(2*r)) return y1 ;
		double dx = x1-x2 ;
		double dx2 = dx*dx ;
		double val = sqrt(4*r*r-dx2) ;
		return y1+val ;
	}
	void Finish(){
		op.flush();
		op.close();
	}
	void p(Object o){
		op.print(o) ;
	}
	void pln(Object o){
		op.println(o) ;
	}
}
class mylist extends ArrayList<Integer>{}
class myset extends TreeSet<Integer>{}
class mystack extends Stack<Integer>{}
class mymap extends TreeMap<Long,Integer>{}
class Reader{
	BufferedReader reader;
	StringTokenizer tokenizer;
	Reader(InputStream input) {
		reader = new BufferedReader(
					new InputStreamReader(input) );
		tokenizer = new StringTokenizer("") ;
	}
	String s() throws IOException {
		while (!tokenizer.hasMoreTokens()){
			tokenizer = new StringTokenizer(
			reader.readLine()) ;
		}
		return tokenizer.nextToken();
	}
	int i() throws IOException {
		return Integer.parseInt(s()) ;
	}
	long l() throws IOException{
		return Long.parseLong(s()) ;
	}
	double d() throws IOException {
		return Double.parseDouble(s()) ;
	}
}


import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.util.Map.Entry;

import static java.lang.Math.*;

public class C extends PrintWriter {

    void run() {

        int n = nextInt();
        int r = nextInt();
        int[] x = nextArray(n);

        double[] y = new double[n];
        Arrays.fill(y, r);

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < i; j++) {
                int dx = abs(x[i] - x[j]);
                int sdy = 4 * r * r - dx * dx;

                if (sdy >= 0) {
                    double dy = sqrt(sdy);
                    y[i] = max(y[i], y[j] + dy);
                }
            }
        }

        for (double v : y) {
            printf(Locale.ENGLISH, "%.10f ", v);
        }

    }

    boolean skip() {
        while (hasNext()) {
            next();
        }
        return true;
    }

    int[][] nextMatrix(int n, int m) {
        int[][] matrix = new int[n][m];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                matrix[i][j] = nextInt();
        return matrix;
    }

    String next() {
        while (!tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(nextLine());
        return tokenizer.nextToken();
    }

    boolean hasNext() {
        while (!tokenizer.hasMoreTokens()) {
            String line = nextLine();
            if (line == null) {
                return false;
            }
            tokenizer = new StringTokenizer(line);
        }
        return true;
    }

    int[] nextArray(int n) {
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = nextInt();
        }
        return array;
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException err) {
            return null;
        }
    }

    public C(OutputStream outputStream) {
        super(outputStream);
    }

    static BufferedReader reader;
    static StringTokenizer tokenizer = new StringTokenizer("");
    static Random rnd = new Random();
    static boolean OJ;

    public static void main(String[] args) throws IOException {
        OJ = System.getProperty("ONLINE_JUDGE") != null;
        C solution = new C(System.out);
        if (OJ) {
            reader = new BufferedReader(new InputStreamReader(System.in));
            solution.run();
        } else {
            reader = new BufferedReader(new FileReader(new File(C.class.getName() + ".txt")));
            long timeout = System.currentTimeMillis();
            while (solution.hasNext()) {
                solution.run();
                solution.println();
                solution.println("----------------------------------");
            }
            solution.println("time: " + (System.currentTimeMillis() - timeout));
        }
        solution.close();
        reader.close();
    }
}


import java.lang.*;
import java.io.*;
import java.util.*;

public class Main {

    public void solve() throws IOException {
        int n = nextInt(), r = nextInt();
        int x[] = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = nextInt();
        }
        double res[] = new double[n];
        res[0] = r;
        for (int i = 1; i < n; i++) {
            double max = r;
            for (int j = 0; j < i; j++) {
                int d = Math.abs(x[i] - x[j]);
                if(d <= 2 * r){
                    double yy = Math.sqrt(4 * r * r - d * d);
                    max = Math.max(max, yy + res[j]);
                }
            }
            res[i] = max;
        }
        for (int i = 0; i < n; i++) {
            out.print(res[i] + " ");
        }
    }

    BufferedReader br;
    StringTokenizer sc;
    PrintWriter out;

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Main().run();
    }

    void run() throws IOException {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
//            br = new BufferedReader(new FileReader("pnumbers.in"));
//            out = new PrintWriter(new File("out.txt"));
            solve();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    String nextToken() throws IOException {
        while (sc == null || !sc.hasMoreTokens()) {
            try {
                sc = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return sc.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

}


import java.io.*;
import java.util.*;
public class CC {
	public static void main(String[] args)throws Throwable {
		MyScanner sc=new MyScanner();
		PrintWriter pw=new PrintWriter(System.out);

		int n=sc.nextInt();
		int r=sc.nextInt();
		int [] x=new int [n];
		for(int i=0;i<n;i++)
			x[i]=sc.nextInt();
		double [] ans=new double [n];
		ans[0]=r;
		for(int i=1;i<n;i++){
			ans[i]=r;
			for(int j=0;j<i;j++){
				double dx=Math.abs(x[i]-x[j]);
				if(dx>2*r)
					continue;
				double y=Math.sqrt((4*r*r)-(dx*dx));
				ans[i]=Math.max(ans[i], ans[j]+y);
			}
		}

		for(double z : ans)
			pw.print(z+" ");
		pw.flush();
		pw.close();
	}

	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next() {while (st == null || !st.hasMoreElements()) {
			try {st = new StringTokenizer(br.readLine());}
			catch (IOException e) {e.printStackTrace();}}
		return st.nextToken();}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());}
		double nextDouble() {return Double.parseDouble(next());}
		String nextLine(){String str = "";
		try {str = br.readLine();}
		catch (IOException e) {e.printStackTrace();}
		return str;}
	}
}


public class Main {

	private static void solve() {
		int n = ni();
		double r = ni();

		double[][] p = new double[n][2];
		double EPS = 0.0000000000001;

		for (int i = 0; i < n; i ++) {
			double x = ni();
			double y = r;
			for (int j = 0; j < i; j ++) {
				double dx = Math.abs(p[j][0] - x);
				if (dx <= r * 2 + EPS) {
					double dy = Math.sqrt(4.0 * r * r - dx * dx);
					y = Math.max(y, p[j][1] + dy);
				}
			}
			out.printf("%.12f ", y);
			p[i][0] = x;
			p[i][1] = y;
		}
		out.println();
	}

	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			@Override
			public void run() {
				long start = System.currentTimeMillis();
				String debug = args.length > 0 ? args[0] : null;
				if (debug != null) {
					try {
						is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
					} catch (Exception e) {
						throw new RuntimeException(e);
					}
				}
				reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
				solve();
				out.flush();
				tr((System.currentTimeMillis() - start) + "ms");
			}
		}, "", 64000000).start();
	}

	private static java.io.InputStream is = System.in;
	private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
	private static java.util.StringTokenizer tokenizer = null;
	private static java.io.BufferedReader reader;

	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new java.util.StringTokenizer(reader.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	private static double nd() {
		return Double.parseDouble(next());
	}

	private static long nl() {
		return Long.parseLong(next());
	}

	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private static char[] ns() {
		return next().toCharArray();
	}

	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}

	private static int[][] ntable(int n, int m) {
		int[][] table = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				table[i][j] = ni();
			}
		}
		return table;
	}

	private static int[][] nlist(int n, int m) {
		int[][] table = new int[m][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				table[j][i] = ni();
			}
		}
		return table;
	}

	private static int ni() {
		return Integer.parseInt(next());
	}

	private static void tr(Object... o) {
		if (is != System.in)
			System.out.println(java.util.Arrays.deepToString(o));
	}
}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int n=ir.nextInt();
		int r=ir.nextInt();
		int[] x=ir.nextIntArray(n);
		double[] ret=new double[n];
		for(int i=0;i<n;i++){
			double ma=r;
			for(int j=0;j<i;j++){
				if(Math.abs(x[i]-x[j])<=2*r){
					ma=Math.max(ma,ret[j]+Math.sqrt(4*(double)Math.pow(r, 2)-Math.pow(x[i]-x[j],2)));
				}
			}
			ret[i]=ma;
		}
		for(int i=0;i<n;i++){
			out.print(ret[i]+(i==n-1?"\n":" "));
		}
	}

	public static void main(String[] args) throws Exception {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}
}


import java.util.*;
import java.io.*;

public class NewYearsCurling {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		StringTokenizer st = new StringTokenizer(sc.nextLine());
		int n = Integer.parseInt(st.nextToken());
		int r = Integer.parseInt(st.nextToken());

		ArrayList<Integer> centers = new ArrayList<Integer>();
		st = new StringTokenizer(sc.nextLine());
		for (int i = 0; i < n; i++) {
			centers.add(Integer.parseInt(st.nextToken()));
		}
		sc.close();
		ArrayList<Point> finalpoints = new ArrayList<Point>();
		for (int i = 0; i < n; i++) {
			double maxy = r;
			for (int j = 0; j < finalpoints.size(); j++) {
				if (finalpoints.get(j).x - centers.get(i) > 2 * r || centers.get(i) - finalpoints.get(j).x > 2 * r)
					continue;
				double dist = Math.sqrt(
						4 * r * r - (finalpoints.get(j).x - centers.get(i)) * (finalpoints.get(j).x - centers.get(i)))
						+ finalpoints.get(j).y;
				if(dist > maxy)
					maxy = dist;
			}

			pw.print(maxy + " ");
			finalpoints.add(new Point(centers.get(i), maxy));
		}

		pw.close();
	}

	public static class Point {
		double x;
		double y;

		public Point(double x, double y) {
			this.x = x;
			this.y = y;
		}
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        TaskC.InputReader in = new TaskC.InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.Solve(in, out);
        out.close();
    }

    static class TaskC {

        void Solve(InputReader in, PrintWriter out) {
            int n = in.NextInt();
            double r = in.NextInt();
            double[] x = new double[n];
            for (int i = 0; i < n; i++) x[i] = in.NextInt();
            double[] y = new double[n];
            for (int i = 0; i < n; i++) {
                double maxY = r;
                for (int j = 0; j < i; j++) {
                    if (Math.abs(x[i] - x[j]) <= 2 * r) {
                        double currentY = Math.sqrt((2 * r) * (2 * r) - (x[i] - x[j]) * (x[i] - x[j])) + y[j];
                        maxY = Math.max(maxY, currentY);
                    }
                }
                y[i] = maxY;
            }
            out.print(y[0]);
            for (int i = 1; i < n; i++) {
                out.print(" " + y[i]);
            }
            out.println();
        }

        static int GetMax(int[] ar) {
            int max = Integer.MIN_VALUE;
            for (int a : ar) {
                max = Math.max(max, a);
            }
            return max;
        }

        static int GetMin(int[] ar) {
            int min = Integer.MAX_VALUE;
            for (int a : ar) {
                min = Math.min(min, a);
            }
            return min;
        }

        static long GetSum(int[] ar) {
            long s = 0;
            for (int a : ar) s += a;
            return s;
        }

        static int[] GetCount(int[] ar) {
            return GetCount(ar, GetMax(ar));
        }

        static int[] GetCount(int[] ar, int maxValue) {
            int[] dp = new int[maxValue + 1];
            for (int a : ar) {
                dp[a]++;
            }
            return dp;
        }

        static class InputReader {
            BufferedReader reader;
            StringTokenizer tokenizer;

            InputReader(InputStream stream) {
                reader = new BufferedReader(new InputStreamReader(stream), 32768);
                tokenizer = null;
            }

            String Next() {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    try {
                        tokenizer = new StringTokenizer(reader.readLine(), " \t\n\r\f,");
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
                return tokenizer.nextToken();
            }

            int NextInt() {
                return Integer.parseInt(Next());
            }

            long NextLong() {
                return Long.parseLong(Next());
            }

            double NextDouble() {
                return Double.parseDouble(Next());
            }

            int[] NextIntArray(int n) {
                return NextIntArray(n, 0);
            }

            int[] NextIntArray(int n, int offset) {
                int[] a = new int[n];
                for (int i = 0; i < n; i++) {
                    a[i] = NextInt() - offset;
                }
                return a;
            }

            int[][] NextIntMatrix(int n, int m) {
                return NextIntMatrix(n, m, 0);
            }

            int[][] NextIntMatrix(int n, int m, int offset) {
                int[][] a = new int[n][m];
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < m; j++) {
                        a[i][j] = NextInt() - offset;
                    }
                }
                return a;
            }
        }
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
    	Scanner in=new Scanner(System.in);
    	int n=in.nextInt(),r=in.nextInt();
    	double[] x=new double[n];
    	for(int i=0; i<n; i++)
    		x[i]=in.nextInt();
    	double[] y=new double[n];
    	for(int i=0; i<n; i++)
    	{
    		y[i]=r;
    		for(int j=0; j<i; j++)
    		{

    			if(Math.abs(x[j]-x[i])<=2*r)
    			{
    				y[i]=Math.max(y[i], y[j]+Math.sqrt(4*r*r-(x[i]-x[j])*(x[i]-x[j])));
    			}
    		}
    	}
    	for(int i=0; i<n; i++)
    		System.out.print(y[i]+" ");
    }
}


import java.io.*;
import java.util.HashSet;
import java.util.StringTokenizer;

public class GB_A {
    FastScanner in;
    PrintWriter out;

    public static void main(String[] arg) {
        new GB_A().run();
    }

    public void solve() throws IOException {
        int n = in.nextInt();
        int r = in.nextInt();
        int[] a = new int[n];
        double[] ans = new double[n];
        a[0] = in.nextInt();
        ans[0] = r;
        for (int i = 1; i < n; i++) {
            a[i] = in.nextInt();
            double max = r;
            for (int j = i - 1; j >= 0; j--) {
                if (Math.abs(a[i] - a[j]) <= 2 * r) {
                    double d = Math.sqrt(4 * r * r - (a[i]- a[j]) * (a[i] - a[j])) + ans[j];
                    max = Math.max(max, d);
                }

            }
            ans[i] = max;
        }
        for (int i = 0; i < n; i++) {
            out.println(ans[i]);
        }
    }

    public void run() {
        try {
            in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
            out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(BufferedReader bufferedReader) {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

    }
}


import java.io.*;
import java.util.*;

public class Codeforces908C {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(f.readLine());
		int n = Integer.parseInt(st.nextToken());
		int r = Integer.parseInt(st.nextToken());
		int[] x = new int[n];
		st = new StringTokenizer(f.readLine());
		for(int i = 0; i < n; i++) {
			x[i] = Integer.parseInt(st.nextToken());
		}
		double[] y = new double[n];
		y[0] = r;
		double hypSq = 4*r*r;
		for(int i = 1; i < n; i++) {
			boolean hit = false;
			double maxY = 0;
			for(int j = 0; j < i; j++) {
				int dx = Math.abs(x[i] - x[j]);
				if(dx == 2*r) {
					if(y[j] > maxY) {
						maxY = y[j];
						hit = true;
					}
				} else if(dx < 2*r) {
					double newY = y[j] + Math.sqrt(hypSq - dx*dx);
					if(newY > maxY) {
						maxY = newY;
						hit = true;
					}
				}
			}
			if(!hit) {
				y[i] = r;
			} else {
				y[i] = maxY;
			}
		}
		StringBuffer s = new StringBuffer("");
		for(int i = 0; i < n; i++) {
			s.append(y[i] + " ");
		}
		System.out.println(s.toString().trim());
	}
}


import com.sun.org.apache.regexp.internal.RE;

import java.io.*;
import java.nio.file.ClosedWatchServiceException;
import java.nio.file.OpenOption;
import java.security.SecureRandom;
import java.util.*;

public class Main {
    public static void main(String[] args) throws FileNotFoundException {
        ConsoleIO io = new ConsoleIO(new InputStreamReader(System.in), new PrintWriter(System.out));
        //String test = "C-large";
        //ConsoleIO io = new ConsoleIO(new FileReader("D:\\Dropbox\\code\\practice\\jb\\src\\" + test + ".in"), new PrintWriter(new File("D:\\Dropbox\\code\\practice\\jb\\src\\" + test + "-out.txt")));

       new Main(io).solve();

        io.close();
    }

    ConsoleIO io;
    Main(ConsoleIO io) {
        this.io = io;
    }

    List<List<Integer>> gr = new ArrayList<>();
    long MOD = 1_000_000_007;

    public void solve() {
        int n = io.ri(), r = io.ri();

        double[] res = new double[n];
        int[] xs = new int[n];
        for(int i = 0;i<n;i++){
            int x = io.ri();
            xs[i] = x;
            double max = r;
            for(int j = 0;j<i;j++){
                int dx = Math.abs(xs[j] - x);
                int dx2 = dx*dx;
                if(dx <= 2*r){
                    max = Math.max(max, Math.sqrt(4*r*r - dx2) + res[j]);
                }
            }
            res[i] = max;
        }

        StringBuilder sb = new StringBuilder();
        for(int i = 0;i<res.length;i++){
            if(i>0)sb.append(' ');
            sb.append(res[i]);
        }

        io.writeLine(sb.toString());
    }

}

class ConsoleIO {

    BufferedReader br;
    PrintWriter out;
    public ConsoleIO(Reader reader, PrintWriter writer){br = new BufferedReader(reader);out = writer;}
    public void flush(){this.out.flush();}
    public void close(){this.out.close();}
    public void writeLine(String s) {this.out.println(s);}
    public void writeInt(int a) {this.out.print(a);this.out.print(' ');}
    public void writeWord(String s){
        this.out.print(s);
    }
    public void writeIntArray(int[] a, int k, String separator) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < k; i++) {
            if (i > 0) sb.append(separator);
            sb.append(a[i]);
        }
        this.writeLine(sb.toString());
    }
    public int read(char[] buf, int len){try {return br.read(buf,0,len);}catch (Exception ex){ return -1; }}
    public String readLine() {try {return br.readLine();}catch (Exception ex){ return "";}}
    public long[] readLongArray() {
        String[]n=this.readLine().trim().split("\\s+");long[]r=new long[n.length];
        for(int i=0;i<n.length;i++)r[i]=Long.parseLong(n[i]);
        return r;
    }
    public int[] readIntArray() {
        String[]n=this.readLine().trim().split("\\s+");int[]r=new int[n.length];
        for(int i=0;i<n.length;i++)r[i]=Integer.parseInt(n[i]);
        return r;
    }
    public int[] readIntArray(int n) {
        int[] res = new int[n];
        char[] all = this.readLine().toCharArray();
        int cur = 0;boolean have = false;
        int k = 0;
        boolean neg = false;
        for(int i = 0;i<all.length;i++){
            if(all[i]>='0' && all[i]<='9'){
                cur = cur*10+all[i]-'0';
                have = true;
            }else if(all[i]=='-') {
                neg = true;
            }
            else if(have){
                res[k++] = neg?-cur:cur;
                cur = 0;
                have = false;
                neg = false;
            }
        }
        if(have)res[k++] = neg?-cur:cur;
        return res;
    }
    public int ri() {
        try {
            int r = 0;
            boolean start = false;
            boolean neg = false;
            while (true) {
                int c = br.read();
                if (c >= '0' && c <= '9') {
                    r = r * 10 + c - '0';
                    start = true;
                } else if (!start && c == '-') {
                    start = true;
                    neg = true;
                } else if (start || c == -1) return neg ? -r : r;
            }
        } catch (Exception ex) {
            return -1;
        }
    }
    public long readLong() {
        try {
            long r = 0;
            boolean start = false;
            boolean neg = false;
            while (true) {
                int c = br.read();
                if (c >= '0' && c <= '9') {
                    r = r * 10 + c - '0';
                    start = true;
                } else if (!start && c == '-') {
                    start = true;
                    neg = true;
                } else if (start || c == -1) return neg ? -r : r;
            }
        } catch (Exception ex) {
            return -1;
        }
    }
    public String readWord() {
        try {
            boolean start = false;
            StringBuilder sb = new StringBuilder();
            while (true) {
                int c = br.read();
                if (c!= ' ' && c!= '\r' && c!='\n' && c!='\t') {
                    sb.append((char)c);
                    start = true;
                } else if (start || c == -1) return sb.toString();
            }
        } catch (Exception ex) {
            return "";
        }
    }
    public char readSymbol() {
        try {
            while (true) {
                int c = br.read();
                if (c != ' ' && c != '\r' && c != '\n' && c != '\t') {
                    return (char) c;
                }
            }
        } catch (Exception ex) {
            return 0;
        }
    }
    //public char readChar(){try {return (char)br.read();}catch (Exception ex){ return 0; }}
}
class Pair {
    public Pair(int a, int b) {this.a = a;this.b = b;}
    public int a;
    public int b;
}
class PairLL {
    public PairLL(long a, long b) {this.a = a;this.b = b;}
    public long a;
    public long b;
}
class Triple {
    public Triple(int a, int b, int c) {this.a = a;this.b = b;this.c = c;}
    public int a;
    public int b;
    public int c;
}


import java.util.*;

public class PC1229 {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int r = sc.nextInt();
		int[] x = new int[n];
		for(int i = 0; i < n; i++){
			x[i] = sc.nextInt();
		}
		double[] ans = new double[n];
		for(int i = 0; i < n; i++){
			double maxY = r;
			for(int j = 0; j < i; j++){
				if(x[j] <= x[i] + 2*r && x[j] >= x[i] - 2*r){
					maxY = Math.max(maxY, ans[j] + Math.sqrt(4 * r * r - (Math.abs(x[i] - x[j])) * (Math.abs(x[i] - x[j]))));
				}
			}
			ans[i] = maxY;
		}
		for(int i = 0; i < n; i++){
			System.out.println(ans[i]);
		}
		sc.close();
	}

}


import java.util.Scanner;

public class C {
  public static void main (String args[]) {
    Scanner in = new Scanner(System.in);

    int n = in.nextInt();
    int r = in.nextInt();

    double pos[][] = new double[n][2];

    for(int i = 0; i < n; i++) {

    	pos[i][0] = in.nextInt();

    	double y = r;

    	for(int j = 0; j < i; j++) {
    		if(Math.abs(pos[i][0] - pos[j][0]) <= 2*r) {

    			double tempy = pos[j][1] + Math.sqrt(Math.pow(2*r, 2) - Math.pow(Math.abs(pos[i][0] - pos[j][0]), 2));

    			if(tempy > y) y = tempy;
    		}
    	}

    	pos[i][1] = y;
    	System.out.print(y + " ");
    }
  }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ilyakor
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int r = in.nextInt();
            ArrayList<PointDouble> centers = new ArrayList<>();
            ArrayList<Integer> xs = new ArrayList<>();
            for (int i = 0; i < n; ++i) {
                int x = in.nextInt();
                double y = r;
                for (int j = 0; j < centers.size(); j++) {
                    int ox = xs.get(j);
                    if (Math.abs(ox - x) > 2 * r) continue;
                    PointDouble c = centers.get(j);
                    double t = Math.abs(ox - x);
                    double h = Math.sqrt(Math.abs(4.0 * r * r - t * t));
                    double val = c.y + h;
                    if (y < val) y = val;
                }
                out.print(String.format("%.20f ", y));
                centers.add(new PointDouble(x, y));
                xs.add(x);
            }
            out.printLine();
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buffer = new byte[10000];
        private int cur;
        private int count;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public static boolean isSpace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int read() {
            if (count == -1) {
                throw new InputMismatchException();
            }
            try {
                if (cur >= count) {
                    cur = 0;
                    count = stream.read(buffer);
                    if (count <= 0)
                        return -1;
                }
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            return buffer[cur++];
        }

        public int readSkipSpace() {
            int c;
            do {
                c = read();
            } while (isSpace(c));
            return c;
        }

        public int nextInt() {
            int sgn = 1;
            int c = readSkipSpace();
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res = res * 10 + c - '0';
                c = read();
            } while (!isSpace(c));
            res *= sgn;
            return res;
        }

    }

    static class PointDouble {
        public double x;
        public double y;

        public PointDouble(double x, double y) {
            this.x = x;
            this.y = y;
        }

        public PointDouble() {
            x = 0;
            y = 0;
        }

    }
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;

public class C {
	static double ycoord(double xi, double yi, double xj, double r) {
		if(Math.abs(xi-xj) > 2*r) return r;
		double dist = Math.sqrt((4*r*r)-((xi-xj)*(xi-xj)));
		//System.out.println("dist" + dist);
		return Math.max(yi+dist, r); //yi - dist?
	}
	public static void main(String[] args) throws Exception {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		double r = sc.nextInt();
		double[] xcoords = new double[n];
		double[] ycoords = new double[n];
		Arrays.fill(ycoords, Integer.MIN_VALUE);
		ycoords[0] = r;
		for(int i = 0; i < n; i++) {
			xcoords[i] = sc.nextDouble();
		}
		System.out.print(r + " ");
		for(int i = 1; i < n; ++i) {
			for(int j = 0; j < i; j++) {
				ycoords[i] = Math.max(ycoord(xcoords[j], ycoords[j],xcoords[i],r),ycoords[i]);
			}
			System.out.print(ycoords[i] + " ");
		}
		out.flush();
	}

	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}

	}
}