#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr<<#x<<':'<<x<<" ";
const int maxn = 2e6+10;
typedef complex<double> C;
C wn(int n, int f) {
    return C(cos(acos(-1.0) / n), f*sin((acos(-1.0)) / n));
}
C inv(int n) {
    return C(1.0 / n, 0);
}

int g[maxn];
void FFT(C *a, int n, int f) {
    for (int i = 0; i < n; i++) if (i > g[i]) swap(a[i], a[g[i]]);
    for (int i = 1; i < n; i <<= 1) {
        C w = wn(i, f), x, y;
        for (int j = 0; j < n; j += i + i) {
            C e;
            e = 1;
            for (int k = 0; k < i; e = e * w, k++) {
                x = a[j + k];
                y = a[j + k + i] * e;
                a[j + k] = x + y;
                a[j + k + i] = x - y;
            }
        }
    }
    if (f == -1) {
        C Inv = inv(n);
        for (int i = 0; i < n; i++) a[i] = a[i] * Inv;
    }
}
void conv(C *a, int n, C *b, int m, C *c) {
    int k = 0, s = 2;
    while ((1 << k) < max(n, m) + 1) k++, s <<= 1;
    for (int i = 1; i < s; i++) g[i] = (g[i / 2] / 2) | ((i & 1) << k);
    FFT(a, s, 1);
    FFT(b, s, 1);
    for (int i = 0; i < s; i++) c[i] = a[i] * b[i];
    FFT(c, s, -1);
}

int mx=0;
int init[maxn],s[maxn],aa[maxn];
C a[maxn],b[maxn],res[maxn];

int main()
{
    int n,x;
    scanf("%d%d",&n,&x);
    for(int i=1;i<=n;i++)
    {
        int temp;scanf("%d",&temp);
        if(temp<x) init[i]=1;else init[i]=0;
        s[i]=s[i-1]+init[i];
    }

    aa[0]=1;
    for(int i=1;i<=n;i++)
        aa[s[i]]++;
//    for(int i=1;i<=n;i++)
//        cout<<aa[i]<<' ';
//    cout<<endl;

    for(int i=n;i<=2*n;i++)
        a[i]=1.0*aa[i-n];
    for(int i=0;i<=n;i++)
        b[i]=a[2*n-i];
//    for(int i=0;i<=2*n;i++)
//        cout<<a[i].real()<<' ';
//    cout<<endl;
//    for(int i=0;i<=2*n;i++)
//        cout<<b[i].real()<<' ';
//    cout<<endl;
    conv(a,2*n+1,b,2*n+1,res);
    res[2*n]=0;
    for(int i=0;i<=n;i++)
    {
        double temp;
        temp=1.0*aa[i]*(aa[i]-1)/2;
        res[2*n]+=temp;
    }
    for(int i=2*n;i<=2*n+n;i++)
        printf("%d ",(int)(res[i].real()+0.5));
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr<<#x<<':'<<x<<" ";
const int maxn = 2*2e5+10;
typedef complex<double> C;
C wn(int n, int f) {
    return C(cos(acos(-1.0) / n), f*sin((acos(-1.0)) / n));
}
C inv(int n) {
    return C(1.0 / n, 0);
}
C as[maxn], bs[maxn], cs[maxn];
C ar[maxn], br[maxn], cr[maxn];
C ap[maxn], bp[maxn], cp[maxn];
int g[maxn];
void FFT(C *a, int n, int f) {
    for (int i = 0; i < n; i++) if (i > g[i]) swap(a[i], a[g[i]]);
    for (int i = 1; i < n; i <<= 1) {
        C w = wn(i, f), x, y;
        for (int j = 0; j < n; j += i + i) {
            C e;
            e = 1;
            for (int k = 0; k < i; e = e * w, k++) {
                x = a[j + k];
                y = a[j + k + i] * e;
                a[j + k] = x + y;
                a[j + k + i] = x - y;
            }
        }
    }
    if (f == -1) {
        C Inv = inv(n);
        for (int i = 0; i < n; i++) a[i] = a[i] * Inv;
    }
}
void conv(C *a, int n, C *b, int m, C *c) {
    int k = 0, s = 2;
    while ((1 << k) < max(n, m) + 1) k++, s <<= 1;
    for (int i = 1; i < s; i++) g[i] = (g[i / 2] / 2) | ((i & 1) << k);
    FFT(a, s, 1);
    FFT(b, s, 1);
    for (int i = 0; i < s; i++) c[i] = a[i] * b[i];
    FFT(c, s, -1);
}

int mx=0;
int init[maxn],s[maxn],aa[maxn];
C a[maxn],b[maxn],res[maxn];

int main()
{
    int n,x;
    scanf("%d%d",&n,&x);
    for(int i=1;i<=n;i++)
    {
        int temp;scanf("%d",&temp);
        if(temp<x) init[i]=1;else init[i]=0;
        s[i]=s[i-1]+init[i];
    }

    aa[0]=1;
    for(int i=1;i<=n;i++)
        aa[s[i]]++;
//    for(int i=1;i<=n;i++)
//        cout<<aa[i]<<' ';
//    cout<<endl;

    for(int i=n;i<=2*n;i++)
        a[i]=1.0*aa[i-n];
    for(int i=0;i<=n;i++)
        b[i]=a[2*n-i];
//    for(int i=0;i<=2*n;i++)
//        cout<<a[i].real()<<' ';
//    cout<<endl;
//    for(int i=0;i<=2*n;i++)
//        cout<<b[i].real()<<' ';
//    cout<<endl;
    conv(a,2*n+1,b,2*n+1,res);
    res[2*n]=0;
    for(int i=0;i<=n;i++)
    {
        double temp;
        temp=1.0*aa[i]*(aa[i]-1)/2;
        res[2*n]+=temp;
    }
    for(int i=2*n;i<=2*n+n;i++)
        printf("%d ",(int)(res[i].real()+0.5));
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr<<#x<<':'<<x<<" ";
const int maxn = 1e6+10;
typedef complex<double> C;
C wn(int n, int f) {
    return C(cos(acos(-1.0) / n), f*sin((acos(-1.0)) / n));
}
C inv(int n) {
    return C(1.0 / n, 0);
}

int g[maxn];
void FFT(C *a, int n, int f) {
    for (int i = 0; i < n; i++) if (i > g[i]) swap(a[i], a[g[i]]);
    for (int i = 1; i < n; i <<= 1) {
        C w = wn(i, f), x, y;
        for (int j = 0; j < n; j += i + i) {
            C e;
            e = 1;
            for (int k = 0; k < i; e = e * w, k++) {
                x = a[j + k];
                y = a[j + k + i] * e;
                a[j + k] = x + y;
                a[j + k + i] = x - y;
            }
        }
    }
    if (f == -1) {
        C Inv = inv(n);
        for (int i = 0; i < n; i++) a[i] = a[i] * Inv;
    }
}
void conv(C *a, int n, C *b, int m, C *c) {
    int k = 0, s = 2;
    while ((1 << k) < max(n, m) + 1) k++, s <<= 1;
    for (int i = 1; i < s; i++) g[i] = (g[i / 2] / 2) | ((i & 1) << k);
    FFT(a, s, 1);
    FFT(b, s, 1);
    for (int i = 0; i < s; i++) c[i] = a[i] * b[i];
    FFT(c, s, -1);
}

int mx=0;
int init[maxn],s[maxn],aa[maxn];
C a[maxn],b[maxn],res[maxn];

int main()
{
    int n,x;
    scanf("%d%d",&n,&x);
    for(int i=1;i<=n;i++)
    {
        int temp;scanf("%d",&temp);
        if(temp<x) init[i]=1;else init[i]=0;
        s[i]=s[i-1]+init[i];
    }

    aa[0]=1;
    for(int i=1;i<=n;i++)
        aa[s[i]]++;
//    for(int i=1;i<=n;i++)
//        cout<<aa[i]<<' ';
//    cout<<endl;

    for(int i=n;i<=2*n;i++)
        a[i]=1.0*aa[i-n];
    for(int i=0;i<=n;i++)
        b[i]=a[2*n-i];
//    for(int i=0;i<=2*n;i++)
//        cout<<a[i].real()<<' ';
//    cout<<endl;
//    for(int i=0;i<=2*n;i++)
//        cout<<b[i].real()<<' ';
//    cout<<endl;
    conv(a,2*n+1,b,2*n+1,res);
    res[2*n]=0;
    for(int i=0;i<=n;i++)
    {
        double temp;
        temp=1.0*aa[i]*(aa[i]-1)/2;
        res[2*n]+=temp;
    }
    for(int i=2*n;i<=2*n+n;i++)
        printf("%d ",(int)(res[i].real()+0.5));
    cout<<endl;
    return 0;
}


#include <cstdio>
#include <cmath>

typedef long long ll;
typedef long double llf;
const llf Pi=std::acos(-1.0);
const int maxl=1024*512;

struct Complex{
	llf x,y;
	Complex(){}
	Complex(llf x0,llf y0){
		x=x0;y=y0;
	}
	Complex operator+(const Complex &a)const{
		return Complex(x+a.x,y+a.y);
	}
	Complex operator-(const Complex &a)const{
		return Complex(x-a.x,y-a.y);
	}
	Complex operator*(const Complex &a)const{
		return Complex(x*a.x-y*a.y,x*a.y+y*a.x);
	}
	Complex operator/(int a)const{
		return Complex(x/a,y/a);
	}
};

struct MUL{
	int lim,len,mp[maxl];
	Complex X[maxl];
	void init(int l){
		lim=1;len=-1;
		while(lim<=l){lim<<=1;++len;}
		for(int i=1;i<lim;++i)mp[i]=(mp[i>>1]>>1)|((i&1)<<len);
	}
	void fft(Complex S[maxl],int op){
		for(int i=1;i<lim;++i)if(i<mp[i]){Complex t=S[i];S[i]=S[mp[i]];S[mp[i]]=t;}
		for(int i=1;i<lim;i<<=1){
			Complex wn(std::cos(Pi/i),std::sin(Pi/i)*op);
			for(int j=0;j<lim;j+=(i<<1)){
				Complex w(1,0);
				for(int k=0;k<i;++k,w=w*wn){
					Complex x=S[j+k],y=S[i+j+k]*w;
					S[j+k]=x+y;
					S[i+j+k]=x-y;
				}
			}
		}
		if(op<0)for(int i=0;i<lim;++i)S[i]=S[i]/lim;
	}
	void operator()(int n,int m,ll S[maxl],ll T[maxl],ll R[maxl]){
		init(n+m);
		for(int i=0;i<=n;++i)X[i].x=S[i];
		for(int i=n+1;i<lim;++i)X[i].x=0;
		for(int i=0;i<=m;++i)X[i].y=T[i];
		for(int i=m+1;i<lim;++i)X[i].y=0;
		fft(X,1);
		for(int i=0;i<lim;++i)X[i]=X[i]*X[i];
		fft(X,-1);
		for(int i=0;i<=n+m;++i)R[i]=X[i].y/2;
		for(int i=n+m+1;i<lim;++i)R[i]=0;
	}
}mul;

int a[maxl];
ll A[maxl],B[maxl];

int main(){
	// freopen("in.txt","r",stdin);
	int n,m;ll ans=0;scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i){
		scanf("%d",a+i);
		// printf("meow %d %d %d\n",a[i],m,a[i]<m);
		if(a[i]<m)a[i]=1;
		else a[i]=0;
	}
	for(int i=1;i<=n;++i){
		a[i]+=a[i-1];
		++A[a[i]];
		// ++B[n-a[i]];
		// printf("%d ",a[i]);
	}
	// printf("\n");
	for(int i=0;i<n;++i){
		++B[n-a[i]];
	}
	// for(int i=0;i<=n;++i)
		// printf("%lld %lld\n",A[i],B[i]);

	for(int i=1,j=1;i<=n;i=j){
		while(j<=n && a[i]==a[j])++j;
		if(a[i])ans+=(ll)(j-i)*(j-i-1)/2;
		else ans+=(ll)(j-i)*(j-i+1)/2;
		// printf("%d %d\n",i,j);
	}
	printf("%lld ",ans);
	mul(n,n,A,B,A);
	for(int i=1;i<=n;++i)
		printf("%lld ",A[n+i]);
	printf("\n");
	return 0;
}


#include <cstdio>
#include <cmath>

typedef long long ll;
typedef long double llf;
const llf Pi=std::acos(-1.0);
const int maxl=1024*512;

struct Complex{
	llf x,y;
	Complex(){}
	Complex(llf x0,llf y0){
		x=x0;y=y0;
	}
	Complex operator+(const Complex &a)const{
		return Complex(x+a.x,y+a.y);
	}
	Complex operator-(const Complex &a)const{
		return Complex(x-a.x,y-a.y);
	}
	Complex operator*(const Complex &a)const{
		return Complex(x*a.x-y*a.y,x*a.y+y*a.x);
	}
	Complex operator/(int a)const{
		return Complex(x/a,y/a);
	}
};

struct MUL{
	int lim,len,mp[maxl];
	Complex X[maxl];
	void init(int l){
		lim=1;len=-1;
		while(lim<=l){lim<<=1;++len;}
		for(int i=1;i<lim;++i)mp[i]=(mp[i>>1]>>1)|((i&1)<<len);
	}
	void fft(Complex S[maxl],int op){
		for(int i=1;i<lim;++i)if(i<mp[i]){Complex t=S[i];S[i]=S[mp[i]];S[mp[i]]=t;}
		for(int i=1;i<lim;i<<=1){
			Complex wn(std::cos(Pi/i),std::sin(Pi/i)*op);
			for(int j=0;j<lim;j+=(i<<1)){
				Complex w(1,0);
				for(int k=0;k<i;++k,w=w*wn){
					Complex x=S[j+k],y=S[i+j+k]*w;
					S[j+k]=x+y;
					S[i+j+k]=x-y;
				}
			}
		}
		if(op<0)for(int i=0;i<lim;++i)S[i]=S[i]/lim;
	}
	void operator()(int n,int m,ll S[maxl],ll T[maxl],ll R[maxl]){
		init(n+m);
		for(int i=0;i<=n;++i)X[i].x=S[i];
		for(int i=n+1;i<lim;++i)X[i].x=0;
		for(int i=0;i<=m;++i)X[i].y=T[i];
		for(int i=m+1;i<lim;++i)X[i].y=0;
		fft(X,1);
		for(int i=0;i<lim;++i)X[i]=X[i]*X[i];
		fft(X,-1);
		for(int i=0;i<=n+m;++i)R[i]=X[i].y/2;
		for(int i=n+m+1;i<lim;++i)R[i]=0;
	}
}mul;

int a[maxl];
ll A[maxl],B[maxl];

int main(){
	// freopen("in.txt","r",stdin);
	int n,m;ll ans=0;scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i){
		scanf("%d",a+i);
		// printf("meow %d %d %d\n",a[i],m,a[i]<m);
		if(a[i]<m)a[i]=1;
		else a[i]=0;
	}
	for(int i=1;i<=n;++i){
		a[i]+=a[i-1];
		++A[a[i]];
		// ++B[n-a[i]];
		// printf("%d ",a[i]);
	}
	// printf("\n");
	for(int i=0;i<n;++i){
		++B[n-a[i]];
	}
	// for(int i=0;i<=n;++i)
		// printf("%lld %lld\n",A[i],B[i]);

	for(int i=1,j=1;i<=n;i=j){
		while(j<=n && a[i]==a[j])++j;
		if(a[i])ans+=(ll)(j-i)*(j-i-1)/2;
		else ans+=(ll)(j-i)*(j-i+1)/2;
		printf("%d %d\n",i,j);
	}
	printf("%lld ",ans);
	mul(n,n,A,B,A);
	for(int i=1;i<=n;++i)
		printf("%lld ",A[n+i]);
	printf("\n");
	return 0;
}


#include <cstdio>
#include <cmath>

typedef long long ll;
typedef long double llf;
const llf Pi=std::acos(-1.0);
const int maxl=1024*512;

struct Complex{
	llf x,y;
	Complex(){}
	Complex(llf x0,llf y0){
		x=x0;y=y0;
	}
	Complex operator+(const Complex &a)const{
		return Complex(x+a.x,y+a.y);
	}
	Complex operator-(const Complex &a)const{
		return Complex(x-a.x,y-a.y);
	}
	Complex operator*(const Complex &a)const{
		return Complex(x*a.x-y*a.y,x*a.y+y*a.x);
	}
	Complex operator/(int a)const{
		return Complex(x/a,y/a);
	}
};

struct MUL{
	int lim,len,mp[maxl];
	Complex X[maxl];
	void init(int l){
		lim=1;len=-1;
		while(lim<=l){lim<<=1;++len;}
		for(int i=1;i<lim;++i)mp[i]=(mp[i>>1]>>1)|((i&1)<<len);
	}
	void fft(Complex S[maxl],int op){
		for(int i=1;i<lim;++i)if(i<mp[i]){Complex t=S[i];S[i]=S[mp[i]];S[mp[i]]=t;}
		for(int i=1;i<lim;i<<=1){
			Complex wn(std::cos(Pi/i),std::sin(Pi/i)*op);
			for(int j=0;j<lim;j+=(i<<1)){
				Complex w(1,0);
				for(int k=0;k<i;++k,w=w*wn){
					Complex x=S[j+k],y=S[i+j+k]*w;
					S[j+k]=x+y;
					S[i+j+k]=x-y;
				}
			}
		}
		if(op<0)for(int i=0;i<lim;++i)S[i]=S[i]/lim;
	}
	void operator()(int n,int m,ll S[maxl],ll T[maxl],ll R[maxl]){
		init(n+m);
		for(int i=0;i<=n;++i)X[i].x=S[i];
		for(int i=n+1;i<lim;++i)X[i].x=0;
		for(int i=0;i<=m;++i)X[i].y=T[i];
		for(int i=m+1;i<lim;++i)X[i].y=0;
		fft(X,1);
		for(int i=0;i<lim;++i)X[i]=X[i]*X[i];
		fft(X,-1);
		for(int i=0;i<=n+m;++i)R[i]=X[i].y/2;
		for(int i=n+m+1;i<lim;++i)R[i]=0;
	}
}mul;

int a[maxl];
ll A[maxl],B[maxl];

int main(){
	// freopen("in.txt","r",stdin);
	int n,m;ll ans=0;scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i){
		scanf("%d",a+i);
		// printf("meow %d %d %d\n",a[i],m,a[i]<m);
		if(a[i]<m)a[i]=1;
		else a[i]=0;
	}
	for(int i=1;i<=n;++i){
		a[i]+=a[i-1];
		++A[a[i]];
		// ++B[n-a[i]];
	}
	for(int i=0;i<n;++i){
		++B[n-a[i]];
	}
	// for(int i=0;i<=n;++i)
		// printf("%lld %lld\n",A[i],B[i]);
	for(int i=1,j=1;i<=n;i=j){
		while(j<=n && a[i]==a[j])++j;
		ans+=(ll)(j-i)*(j-i-1)/2;
		// printf("%d %d\n",i,j);
	}
	printf("%lld ",ans);
	mul(n,n,A,B,A);
	for(int i=1;i<=n;++i)
		printf("%lld ",A[n+i]);
	printf("\n");
	return 0;
}


#include <cstdio>
#include <cmath>

typedef long long ll;
typedef long double llf;
const llf Pi=std::acos(-1.0);
const int maxl=1024*512;

struct Complex{
	llf x,y;
	Complex(){}
	Complex(llf x0,llf y0){
		x=x0;y=y0;
	}
	Complex operator+(const Complex &a)const{
		return Complex(x+a.x,y+a.y);
	}
	Complex operator-(const Complex &a)const{
		return Complex(x-a.x,y-a.y);
	}
	Complex operator*(const Complex &a)const{
		return Complex(x*a.x-y*a.y,x*a.y+y*a.x);
	}
	Complex operator/(int a)const{
		return Complex(x/a,y/a);
	}
};

struct MUL{
	int lim,len,mp[maxl];
	Complex X[maxl];
	void init(int l){
		lim=1;len=-1;
		while(lim<=l){lim<<=1;++len;}
		for(int i=1;i<lim;++i)mp[i]=(mp[i>>1]>>1)|((i&1)<<len);
	}
	void fft(Complex S[maxl],int op){
		for(int i=1;i<lim;++i)if(i<mp[i]){Complex t=S[i];S[i]=S[mp[i]];S[mp[i]]=t;}
		for(int i=1;i<lim;i<<=1){
			Complex wn(std::cos(Pi/i),std::sin(Pi/i)*op);
			for(int j=0;j<lim;j+=(i<<1)){
				Complex w(1,0);
				for(int k=0;k<i;++k,w=w*wn){
					Complex x=S[j+k],y=S[i+j+k]*w;
					S[j+k]=x+y;
					S[i+j+k]=x-y;
				}
			}
		}
		if(op<0)for(int i=0;i<lim;++i)S[i]=S[i]/lim;
	}
	void operator()(int n,int m,ll S[maxl],ll T[maxl],ll R[maxl]){
		init(n+m);
		for(int i=0;i<=n;++i)X[i].x=S[i];
		for(int i=n+1;i<lim;++i)X[i].x=0;
		for(int i=0;i<=m;++i)X[i].y=T[i];
		for(int i=m+1;i<lim;++i)X[i].y=0;
		fft(X,1);
		for(int i=0;i<lim;++i)X[i]=X[i]*X[i];
		fft(X,-1);
		for(int i=0;i<=n+m;++i)R[i]=std::round(X[i].y/2);
		for(int i=n+m+1;i<lim;++i)R[i]=0;
	}
}mul;

int a[maxl];
ll A[maxl],B[maxl];

int main(){
	// freopen("in.txt","r",stdin);
	int n,m;ll ans=0;scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i){
		scanf("%d",a+i);
		// printf("meow %d %d %d\n",a[i],m,a[i]<m);
		if(a[i]<m)a[i]=1;
		else a[i]=0;
	}
	for(int i=1;i<=n;++i){
		a[i]+=a[i-1];
		++A[a[i]];
		// ++B[n-a[i]];
		// printf("%d ",a[i]);
	}
	// printf("\n");
	for(int i=0;i<n;++i){
		++B[n-a[i]];
	}
	// for(int i=0;i<=n;++i)
		// printf("%lld %lld\n",A[i],B[i]);

	for(int i=1,j=1;i<=n;i=j){
		while(j<=n && a[i]==a[j])++j;
		if(a[i])ans+=(ll)(j-i)*(j-i-1)/2;
		else ans+=(ll)(j-i)*(j-i+1)/2;
		// printf("%d %d\n",i,j);
	}
	printf("%lld ",ans);
	mul(n,n,A,B,A);
	for(int i=1;i<=n;++i)
		printf("%lld ",A[n+i]);
	printf("\n");
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<queue>
#define ll long long
using namespace std;
const double PI=acos(-1.0);
struct Complex
{
    double x,y;
    Complex(double _x=0.0,double _y=0.0){
        x=_x;
        y=_y;
    }
    Complex operator-(const Complex &b)const{
        return Complex(x-b.x,y-b.y);
    }
    Complex operator+(const Complex &b)const{
        return Complex(x+b.x,y+b.y);
    }
    Complex operator*(const Complex &b)const{
        return Complex(x*b.x-y*b.y,x*b.y+y*b.x);
    }
};//复数定义
struct FFT
{
    void change(Complex y[],int len)//len必须是2的幂次
    {
        int i,j,k;
        for(i=1,j=len>>1;i<len-1;i++)
        {
            if(i<j)swap(y[i],y[j]);
            k=len>>1;
            while(j>=k)
            {
                j-=k;
                k/=2;
            }
            if(j<k)j+=k;
        }
    }
    void transfer(Complex y[],int len,int on)//len必须是2的幂次
    {
        change(y,len);
        for(int h=2;h<=len;h<<=1)
        {
            Complex wn(cos(-on*2*PI/h),sin(-on*2*PI/h));
            for(int j=0;j<len;j+=h)
            {
                Complex w(1,0);
                for(int k=j;k<j+h/2;k++)
                {
                    Complex u=y[k];
                    Complex t=w*y[k+h/2];
                    y[k]=u+t;
                    y[k+h/2]=u-t;
                    w=w*wn;
                }
            }
        }
        if(on==-1)
            for(int i=0;i<len;i++)
                y[i].x/=len;
    }//on为1时是把系数表示转化为点值表示即DFT，为-1时即逆DFT，还原为系数表示
    inline void mul(Complex x1[],int n1,Complex x2[],int n2,ll res[],int& n)
    {
        n=1;
        while(n<n1*2)n<<=1;//把len填充到2的幂次
        for(int i=n1;i<n;i++)
            x1[i]=Complex(0,0);//补位填零
        for(int i=n2;i<n;i++)
            x2[i]=Complex(0,0);//补位填零
        transfer(x1,n,1);//转化为点值
        transfer(x2,n,1);//转化为点值
        for(int i=0;i<n;i++)
            x1[i]=x1[i]*x2[i];
        transfer(x1,n,-1);//转化为系数
        for(int i=0;i<n;i++)
            res[i]=(int)(x1[i].x+0.5);//补精度
        //for(int i=n1;i<n;i++)res[i%n1]+=res[i];
        n=n1+n2-1;
        //while(res[n]<=0&&n>0)n--;
        //n++;
    }
}fft;
const int maxx=(262144)*2+5;
Complex x1[maxx],x2[maxx];
ll res[maxx];
int n,x;
int a[200005];
int f[200005];
int main()
{
    cin>>n>>x;
    int y;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&y);
        a[i]=y<x?1:0;
    }
    for(int i=1;i<n;i++)a[i]+=a[i-1];
    for(int i=0;i<n;i++)f[a[i]]++;f[0]++;

    for(int i=0;i<=n;i++)x1[i]=Complex(f[i],0);
    for(int i=0;i<=n;i++)x2[i]=Complex(f[n-i],0);
    int _n;
    fft.mul(x1,n+1,x2,n+1,res,_n);
    res[n]-=n+1;
    res[n]/=2;
    for(int i=n;i<_n;i++)printf("%lld ",res[i]);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
const double PI=acos(-1.0);
struct Complex
{
    double x,y;
    Complex(double _x=0.0,double _y=0.0){
        x=_x;
        y=_y;
    }
    Complex operator-(const Complex &b)const{
        return Complex(x-b.x,y-b.y);
    }
    Complex operator+(const Complex &b)const{
        return Complex(x+b.x,y+b.y);
    }
    Complex operator*(const Complex &b)const{
        return Complex(x*b.x-y*b.y,x*b.y+y*b.x);
    }
};//复数定义
struct FFT
{
    void change(Complex y[],int len)//len必须是2的幂次
    {
        int i,j,k;
        for(i=1,j=len>>1;i<len-1;i++)
        {
            if(i<j)swap(y[i],y[j]);
            k=len>>1;
            while(j>=k)
            {
                j-=k;
                k/=2;
            }
            if(j<k)j+=k;
        }
    }
    void transfer(Complex y[],int len,int on)//len必须是2的幂次
    {
        change(y,len);
        for(int h=2;h<=len;h<<=1)
        {
            Complex wn(cos(-on*2*PI/h),sin(-on*2*PI/h));
            for(int j=0;j<len;j+=h)
            {
                Complex w(1,0);
                for(int k=j;k<j+h/2;k++)
                {
                    Complex u=y[k];
                    Complex t=w*y[k+h/2];
                    y[k]=u+t;
                    y[k+h/2]=u-t;
                    w=w*wn;
                }
            }
        }
        if(on==-1)
            for(int i=0;i<len;i++)
                y[i].x/=len;
    }//on为1时是把系数表示转化为点值表示即DFT，为-1时即逆DFT，还原为系数表示
    inline void mul(Complex x1[],int n1,Complex x2[],int n2,int res[],int& n)
    {
        n=1;
        while(n<n1*2)n<<=1;//把len填充到2的幂次
        for(int i=n1;i<n;i++)
            x1[i]=Complex(0,0);//补位填零
        for(int i=n2;i<n;i++)
            x2[i]=Complex(0,0);//补位填零
        transfer(x1,n,1);//转化为点值
        transfer(x2,n,1);//转化为点值
        for(int i=0;i<n;i++)
            x1[i]=x1[i]*x2[i];
        transfer(x1,n,-1);//转化为系数
        for(int i=0;i<n;i++)
            res[i]=(int)(x1[i].x+0.5);//补精度
        //for(int i=n1;i<n;i++)res[i%n1]+=res[i];
        n=n1+n2-1;
        //while(res[n]<=0&&n>0)n--;
        //n++;
    }
}fft;
const int maxx=(262144)*2+5;
Complex x1[maxx],x2[maxx];
int res[maxx];
int n,x;
int a[200005];
int f[200005];
int main()
{
    cin>>n>>x;
    int y;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&y);
        a[i]=y<x?1:0;
    }
    for(int i=1;i<n;i++)a[i]+=a[i-1];
    for(int i=0;i<n;i++)f[a[i]]++;f[0]++;

    for(int i=0;i<=n;i++)x1[i]=Complex(f[i],0);
    for(int i=0;i<=n;i++)x2[i]=Complex(f[n-i],0);
    int _n;
    fft.mul(x1,n+1,x2,n+1,res,_n);
    res[n]-=n+1;
    res[n]/=2;
    for(int i=n;i<_n;i++)printf("%d ",res[i]);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<queue>
#define ll long long
using namespace std;
const double PI=acos(-1.0);
struct Complex
{
    double x,y;
    Complex(double _x=0.0,double _y=0.0){
        x=_x;
        y=_y;
    }
    Complex operator-(const Complex &b)const{
        return Complex(x-b.x,y-b.y);
    }
    Complex operator+(const Complex &b)const{
        return Complex(x+b.x,y+b.y);
    }
    Complex operator*(const Complex &b)const{
        return Complex(x*b.x-y*b.y,x*b.y+y*b.x);
    }
};//复数定义
struct FFT
{
    void change(Complex y[],int len)//len必须是2的幂次
    {
        int i,j,k;
        for(i=1,j=len>>1;i<len-1;i++)
        {
            if(i<j)swap(y[i],y[j]);
            k=len>>1;
            while(j>=k)
            {
                j-=k;
                k/=2;
            }
            if(j<k)j+=k;
        }
    }
    void transfer(Complex y[],int len,int on)//len必须是2的幂次
    {
        change(y,len);
        for(int h=2;h<=len;h<<=1)
        {
            Complex wn(cos(-on*2*PI/h),sin(-on*2*PI/h));
            for(int j=0;j<len;j+=h)
            {
                Complex w(1,0);
                for(int k=j;k<j+h/2;k++)
                {
                    Complex u=y[k];
                    Complex t=w*y[k+h/2];
                    y[k]=u+t;
                    y[k+h/2]=u-t;
                    w=w*wn;
                }
            }
        }
        if(on==-1)
            for(int i=0;i<len;i++)
                y[i].x/=len;
    }//on为1时是把系数表示转化为点值表示即DFT，为-1时即逆DFT，还原为系数表示
    inline void mul(Complex x1[],int n1,Complex x2[],int n2,ll res[],int& n)
    {
        n=1;
        while(n<n1*2)n<<=1;//把len填充到2的幂次
        for(int i=n1;i<n;i++)
            x1[i]=Complex(0,0);//补位填零
        for(int i=n2;i<n;i++)
            x2[i]=Complex(0,0);//补位填零
        transfer(x1,n,1);//转化为点值
        transfer(x2,n,1);//转化为点值
        for(int i=0;i<n;i++)
            x1[i]=x1[i]*x2[i];
        transfer(x1,n,-1);//转化为系数
        for(int i=0;i<n;i++)
            res[i]=(ll)(x1[i].x+0.5);//补精度
        //for(int i=n1;i<n;i++)res[i%n1]+=res[i];
        n=n1+n2-1;
        //while(res[n]<=0&&n>0)n--;
        //n++;
    }
}fft;
const int maxx=(262144)*2+5;
Complex x1[maxx],x2[maxx];
ll res[maxx];
int n,x;
int a[200005];
int f[200005];
int main()
{
    cin>>n>>x;
    int y;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&y);
        a[i]=y<x?1:0;
    }
    for(int i=1;i<n;i++)a[i]+=a[i-1];
    for(int i=0;i<n;i++)f[a[i]]++;f[0]++;

    for(int i=0;i<=n;i++)x1[i]=Complex(f[i],0);
    for(int i=0;i<=n;i++)x2[i]=Complex(f[n-i],0);
    int _n;
    fft.mul(x1,n+1,x2,n+1,res,_n);
    res[n]=0;
    for(int i=0;i<=n;i++)if(f[i])res[n]+=(ll)f[i]*(f[i]-1)/2;
    for(int i=n;i<_n;i++)printf("%lld ",res[i]);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<queue>
#define ll long long
using namespace std;
const double PI=acos(-1.0);
struct Complex
{
    double x,y;
    Complex(double _x=0.0,double _y=0.0){
        x=_x;
        y=_y;
    }
    Complex operator-(const Complex &b)const{
        return Complex(x-b.x,y-b.y);
    }
    Complex operator+(const Complex &b)const{
        return Complex(x+b.x,y+b.y);
    }
    Complex operator*(const Complex &b)const{
        return Complex(x*b.x-y*b.y,x*b.y+y*b.x);
    }
};//复数定义
struct FFT
{
    void change(Complex y[],int len)//len必须是2的幂次
    {
        int i,j,k;
        for(i=1,j=len>>1;i<len-1;i++)
        {
            if(i<j)swap(y[i],y[j]);
            k=len>>1;
            while(j>=k)
            {
                j-=k;
                k/=2;
            }
            if(j<k)j+=k;
        }
    }
    void transfer(Complex y[],int len,int on)//len必须是2的幂次
    {
        change(y,len);
        for(int h=2;h<=len;h<<=1)
        {
            Complex wn(cos(-on*2*PI/h),sin(-on*2*PI/h));
            for(int j=0;j<len;j+=h)
            {
                Complex w(1,0);
                for(int k=j;k<j+h/2;k++)
                {
                    Complex u=y[k];
                    Complex t=w*y[k+h/2];
                    y[k]=u+t;
                    y[k+h/2]=u-t;
                    w=w*wn;
                }
            }
        }
        if(on==-1)
            for(int i=0;i<len;i++)
                y[i].x/=len;
    }//on为1时是把系数表示转化为点值表示即DFT，为-1时即逆DFT，还原为系数表示
    inline void mul(Complex x1[],int n1,Complex x2[],int n2,ll res[],int& n)
    {
        n=1;
        while(n<n1*2)n<<=1;//把len填充到2的幂次
        for(int i=n1;i<n;i++)
            x1[i]=Complex(0,0);//补位填零
        for(int i=n2;i<n;i++)
            x2[i]=Complex(0,0);//补位填零
        transfer(x1,n,1);//转化为点值
        transfer(x2,n,1);//转化为点值
        for(int i=0;i<n;i++)
            x1[i]=x1[i]*x2[i];
        transfer(x1,n,-1);//转化为系数
        for(int i=0;i<n;i++)
            res[i]=(ll)(x1[i].x+0.5);//补精度
        //for(int i=n1;i<n;i++)res[i%n1]+=res[i];
        n=n1+n2-1;
        //while(res[n]<=0&&n>0)n--;
        //n++;
    }
}fft;
const int maxx=(262144)*2+5;
Complex x1[maxx],x2[maxx];
ll res[maxx];
int n,x;
int a[200005];
int f[200005];
int main()
{
    cin>>n>>x;
    int y;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&y);
        a[i]=y<x?1:0;
    }
    for(int i=1;i<n;i++)a[i]+=a[i-1];
    for(int i=0;i<n;i++)f[a[i]]++;f[0]++;

    for(int i=0;i<=n;i++)x1[i]=Complex(f[i],0);
    for(int i=0;i<=n;i++)x2[i]=Complex(f[n-i],0);
    int _n;
    fft.mul(x1,n+1,x2,n+1,res,_n);
    res[n]-=n+1;
    res[n]/=2;
    for(int i=n;i<_n;i++)printf("%lld ",res[i]);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<queue>
#include<complex>
#define ll long long
#define Complex complex<double>
using namespace std;
const double PI=acos(-1.0);
/*struct Complex
{
    double x,y;
    Complex(double _x=0.0,double _y=0.0){
        x=_x;
        y=_y;
    }
    Complex operator-(const Complex &b)const{
        return Complex(x-b.x,y-b.y);
    }
    Complex operator+(const Complex &b)const{
        return Complex(x+b.x,y+b.y);
    }
    Complex operator*(const Complex &b)const{
        return Complex(x*b.x-y*b.y,x*b.y+y*b.x);
    }
};//复数定义*/
struct FFT
{
    void change(Complex y[],int len)//len必须是2的幂次
    {
        int i,j,k;
        for(i=1,j=len>>1;i<len-1;i++)
        {
            if(i<j)swap(y[i],y[j]);
            k=len>>1;
            while(j>=k)
            {
                j-=k;
                k/=2;
            }
            if(j<k)j+=k;
        }
    }
    void transfer(Complex y[],int len,int on)//len必须是2的幂次
    {
        change(y,len);
        for(int h=2;h<=len;h<<=1)
        {
            Complex wn(cos(-on*2*PI/h),sin(-on*2*PI/h));
            for(int j=0;j<len;j+=h)
            {
                Complex w(1,0);
                for(int k=j;k<j+h/2;k++)
                {
                    Complex u=y[k];
                    Complex t=w*y[k+h/2];
                    y[k]=u+t;
                    y[k+h/2]=u-t;
                    w=w*wn;
                }
            }
        }
        if(on==-1)
            for(int i=0;i<len;i++)
                y[i]/=len;
    }//on为1时是把系数表示转化为点值表示即DFT，为-1时即逆DFT，还原为系数表示
    inline void mul(Complex x1[],int n1,Complex x2[],int n2,ll res[],int& n)
    {
        n=1;
        while(n<n1*2)n<<=1;//把len填充到2的幂次
        for(int i=n1;i<n;i++)
            x1[i]=Complex(0,0);//补位填零
        for(int i=n2;i<n;i++)
            x2[i]=Complex(0,0);//补位填零
        transfer(x1,n,1);//转化为点值
        transfer(x2,n,1);//转化为点值
        for(int i=0;i<n;i++)
            x1[i]=x1[i]*x2[i];
        transfer(x1,n,-1);//转化为系数
        for(int i=0;i<n;i++)
            res[i]=(ll)(x1[i].real()+0.5);//补精度
        n=n1+n2-1;
    }
}fft;
const int maxx=(262144)*2+5;
Complex x1[maxx],x2[maxx];
ll res[maxx];
int n,x;
int a[200005];
int f[200005];
int main()
{
    cin>>n>>x;
    int y;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&y);
        a[i]=y<x?1:0;
    }
    for(int i=1;i<n;i++)a[i]+=a[i-1];
    for(int i=0;i<n;i++)f[a[i]]++;f[0]++;

    for(int i=0;i<=n;i++)x1[i]=Complex(f[i],0);
    for(int i=0;i<=n;i++)x2[i]=Complex(f[n-i],0);
    int _n;
    fft.mul(x1,n+1,x2,n+1,res,_n);
    res[n]=0;
    for(int i=0;i<=n;i++)if(f[i])res[n]+=(ll)f[i]*(f[i]-1)/2;
    for(int i=n;i<_n;i++)printf("%lld ",res[i]);
    return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
long long n,k,a[200000],sum[200000];
double ans,t;
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sum[0]=a[0];t=n-k+1;
    for(int i=1;i<n;i++)
    sum[i]=sum[i-1]+a[i];

    ans+=sum[k-1];
    for(int i=1;i+k-1<n;i++)
    ans+=(sum[i+k-1]-sum[i-1]);

  printf("%0.8lf", ans/t);

}


#include<iostream>
using namespace std;
double n,k;
double a[1000000];
long long ans;
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(n==1)
    {cout<<a[0]<<endl;return 0;}
    for(int i=0;i+k-1<n;i++)
    for(int j=i;j<i+k;j++)
    ans+=a[j];
    cout<<ans/(n-k+1)<<endl;

}


#include<iostream>
using namespace std;
long long n,k;
long long ans,a[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(n==1)
    {cout<<a[0]<<endl;return 0;}
    for(int i=0;i+k-1<n;i++)
    for(int j=i;j<i+k;j++)
    ans+=a[j];
    cout<<ans/(n-k+1)<<endl;

}


#include<iostream>
#include<cstdio>
using namespace std;
int n,k;
double ans,a[1000000],sum[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sum[0]=a[0];
    for(int i=1;i<n;i++)
    sum[i]=sum[i-1]+a[i];

    ans+=sum[k-1]/(double)(n-k+1);
    for(int i=1;i+k-1<n;i++)
    ans+=(sum[i+k-1]-sum[i-1])/(double)(n-k+1);

    ans/=(double)(n-k+1);
  printf("%.8f", ans);

}


#include<iostream>
using namespace std;
double n,k;
double ans,a[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(n==1)
    {cout<<a[0]<<endl;return 0;}
    for(int i=0;i<n-k+1;i++)
    for(int j=i;j+k<n;j++)
    ans+=a[j];
    cout<<ans/(n-k+1)<<endl;

}


 #include<iostream>
#include<cstdio>
using namespace std;
long long n,k;
long long ans,a[1000000],sum[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sum[0]=a[0];
    for(int i=1;i<n;i++)
    sum[i]=sum[i-1]+a[i];
    ans+=sum[k-1];
    for(int i=1;i+k-1<n;i++)
    ans+=sum[i+k-1]-sum[i-1];
  printf("%.8f", ans/(n-k+1));

}


#include<iostream>
using namespace std;
double n,k;
long long ans,a[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(n==1)
    {cout<<a[0]<<endl;return 0;}
    for(int i=0;i+k-1<n;i++)
    for(int j=i;j<i+k;j++)
    ans+=a[j];
    if(ans>10000000)

    cout<<ans/(n-k+1)<<endl;
    else
    cout<<(double)ans/(n-k+1)<<endl;

}


#include<iostream>
#include<cstdio>
using namespace std;
long long n,k;
long long ans,a[1000000],sum[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sum[0]=a[0];
    for(int i=1;i<n;i++)
    sum[i]=sum[i-1]+a[i];
    ans+=sum[k-1];
    for(int i=1;i+k-1<n;i++)
    ans+=sum[i+k-1]-sum[i-1];
    //cout<<(n-k+1)<<endl;
    ans/=(n-k+1);
  printf("%.8f", (double)ans);

}


#include<iostream>
#include<cstdio>
using namespace std;
int n,k;
double ans,a[200000],sum[200000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sum[0]=a[0];
    for(int i=1;i<n;i++)
    sum[i]=sum[i-1]+a[i];
    ans+=sum[k-1];
    for(int i=1;i+k-1<n;i++)
    ans+=sum[i+k-1]-sum[i-1];
    //cout<<(n-k+1)<<endl;
    ans/=(double)(n-k+1);
  printf("%.8f", ans);

}


#include<iostream>
#include<cstdio>
using namespace std;
long long n,k;
double ans,a[1000000],sum[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sum[0]=a[0];long long t=n-k+1;
    for(int i=1;i<n;i++)
    sum[i]=sum[i-1]+a[i];

    ans+=sum[k-1]/(double)t;
    for(int i=1;i+k-1<n;i++)
    ans+=(sum[i+k-1]-sum[i-1])/(double)t;

  printf("%.8f", ans);

}


#include<iostream>
using namespace std;
double n,k;
long long ans,a[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(n==1)
    {cout<<a[0]<<endl;return 0;}
    for(int i=0;i+k-1<n;i++)
    for(int j=i;j<i+k;j++)
    ans+=a[j];
    if(ans>1000000000)
    cout<<ans/(n-k+1)<<endl;
    else
    cout<<(double)ans/(n-k+1)<<endl;

}


#include<iostream>
#include<cstdio>
using namespace std;
int n,k;
double ans,a[1000000],sum[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sum[0]=a[0];
    for(int i=1;i<n;i++)
    sum[i]=sum[i-1]+a[i];
    ans+=sum[k-1];
    for(int i=1;i+k-1<n;i++)
    ans+=sum[i+k-1]-sum[i-1];
    //cout<<(n-k+1)<<endl;
    ans/=(double)(n-k+1);
  printf("%.8f", (double)ans);

}


#include<iostream>
#include<cstdio>
using namespace std;
int n,k;
double ans,a[1000000],sum[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sum[0]=a[0];
    for(int i=1;i<n;i++)
    sum[i]=sum[i-1]+a[i];

    ans+=sum[k-1]/(double)(n-k+1);
    for(int i=1;i+k-1<n;i++)
    ans+=(sum[i+k-1]-sum[i-1])/(double)(n-k+1);

  printf("%.8f", ans);

}


#include<iostream>
using namespace std;
double n,k;
double ans,a[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(n==1)
    {cout<<a[0]<<endl;return 0;}
    for(int i=0;i<n-k;i++)
    for(int j=i;j+k<n;j++)
    ans+=a[j];
    cout<<ans/(n-k+1)<<endl;

}


#include<iostream>
using namespace std;
double n,k;
long long ans,a[1000000],sum[1000000];
main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sum[0]=a[0];
    for(int i=1;i<n;i++)
    sum[i]=sum[i-1]+a[i];
    ans+=s[k-1];
    for(int i=1;i+k-1<n;i++)
    ans+=sum[i+k-1]-sum[i-1];
  printf("%.8f", ans);

}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,i,k,m,l;
    double j,w,sum=0,s=0;
    cin>>n>>k;
    double a[n];
    for(i=0;i<n;i++)cin>>a[i];
    w=n-k+1;
    for(i=0;i<k;i++){
        s=s+a[i];
    }
    sum=s;
    l=0;m=k;
    while(m<n){
        s=s+a[m]-a[l];
        sum=sum+s;m++;l++;
    }
    cout.precision(17);
    double d=sum/w;
    cout<<d;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,i,k,m,l;
    long long int j,w,sum=0,s=0;
    cin>>n>>k;
    long long int  a[n];
    for(i=0;i<n;i++)cin>>a[i];
    w=n-k+1;
    for(i=0;i<k;i++){
        s=s+a[i];
    }
    sum=s;
    l=0;m=k;
    while(m<n){
        s=s+a[m]-a[l];
        sum=sum+s;m++;l++;
    }
    cout.precision(17);
    double d=(double)sum/w;
    cout<<d;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long n,i,k,m,w,sum=0;
    cin>>n>>k;
    long a[n+1];a[0]=0;
    for(i=1;i<=n;i++){cin>>a[i];a[i]+=a[i-1];}
    w=n-k+1;
    for(m=k;m<=n;m++){
        sum=sum+a[m]-a[m-k];
    }
    cout.precision(16);
    double d=(double)sum/w;
    cout<<d;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,i,k,m,l;
    long j,w,sum=0,s=0;
    cin>>n>>k;
    long a[n];
    for(i=0;i<n;i++){cin>>a[i];}
    for(i=1;i<n;i++){a[i]+=a[i-1];}
    w=n-k+1;
    for(i=0;i<k;i++){
        s=s+a[i];
    }
    sum=a[k-1];
    for(m=k;m<n;m++){
        sum=sum+a[m]-a[m-k];
    }
    cout.precision(16);
    double d=(double)sum/w;
    cout<<d;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long n,i,k,m,w;double sum=0;
    cin>>n>>k;
    long a[n+1];a[0]=0;
    for(i=1;i<=n;i++){cin>>a[i];a[i]+=a[i-1];}
    w=n-k+1;
    for(m=k;m<=n;m++){
        sum+=(double)(a[m]-a[m-k])/w;
    }
    cout.precision(16);
    cout<<sum;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,i,k,m,l;
    double j,w,sum=0,s=0;
    cin>>n>>k;
    double a[n];
    for(i=0;i<n;i++)cin>>a[i];
    w=n-k+1;
    for(i=0;i<k;i++){
        s=s+a[i];
    }
    sum=s;
    l=0;m=k;
    while(m<n){
        s=s+a[m]-a[l];
        sum=sum+s;m++;l++;
    }
    double d=sum/w;
    cout<<fixed<<setprecision(6)<<d;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,i,k,m,w;double sum=0;
    cin>>n>>k;
    long long int a[n+1];a[0]=0;
    for(i=1;i<=n;i++){cin>>a[i];a[i]+=a[i-1];}
    w=n-k+1;
    for(m=k;m<=n;m++){
        sum+=(double)(a[m]-a[m-k])/w;
    }
    cout.precision(16);
    cout<<sum;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    cout.precision(17);
    long long int n,i,k,m;
    double w,sum=0,s=0;
    cin>>n>>k;
    double a[n];
    for(i=0;i<n;i++){cin>>a[i];sum=sum+a[i];}
    w=n-k+1;
    //cout<<sum<<endl;
    sum=sum*k;
    m=k;
    while(k>0){
        s=s+(k-1)*(a[m-k]+a[n-1+k-m]);k--;
    }
    //cout<<sum<<" "<<s<<" "<<w<<endl;
    double d=(sum-s)/w;
    cout<<d;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long n,i,k,m,w,sum=0;
    cin>>n>>k;
    long a[n];
    for(i=0;i<n;i++){cin>>a[i];}
    for(i=1;i<n;i++){a[i]+=a[i-1];}
    w=n-k+1;
    sum=a[k-1];
    for(m=k;m<n;m++){
        sum=sum+a[m]-a[m-k];
    }
    cout.precision(16);
    double d=(double)sum/w;
    cout<<d;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,i,k,m;
    double w,sum=0,s=0;
    cin>>n>>k;
    double d;int a[n];
    for(i=0;i<n;i++){cin>>a[i];sum=sum+a[i];}
    w=n-k+1;
    //cout<<sum<<endl;
    sum=sum*k;
    m=k;
    while(k>0){
        s=s+(k-1)*(a[m-k]+a[n-1+k-m]);k--;
    }
    //cout<<sum<<" "<<s<<" "<<w<<endl;
    d=(sum-s)/w;
    cout<<fixed<<setprecision(6)<<d;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,i,k,m;
    long long int w,sum=0,s=0;
    cin>>n>>k;
    double d;int a[n];
    for(i=0;i<n;i++){cin>>a[i];sum=sum+a[i];}
    w=n-k+1;
    //cout<<sum<<endl;
    sum=sum*k;
    m=k;
    while(k>0){
        s=s+(k-1)*(a[m-k]+a[n-1+k-m]);k--;
    }
    //cout<<sum<<" "<<s<<" "<<w<<endl;
    d=(double)(sum-s)/w;
    cout<<fixed<<setprecision(6)<<d;
    return 0;
}


#include<iostream>
using namespace std;
int n,k,i,j,a[1000000];
double ans;
int main()
{
    cin>>n>>k;
    for (i=0; i<n; i++)
    cin>>a[i];
    for (i=0; i<n-k+1; i++)
    {
        for (j=i; j<n-k+1+i; j++){
        //cout<<a[j]<<" "<<j<<endl;
        //system ("pause");
        ans=ans+a[j];
        }
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
//system ("pause");
}


#include<iostream>
#include<cstdio>
using namespace std;
int n,k,i,j,a[1000000];
double ans;
int main()
{
    cin>>n>>k;
    for (i=0; i<n; i++)
    cin>>a[i];
    for (i=0; i<n-k+1; i++)
    {
        for (j=i; j<n-k+1+i; j++){
        //cout<<a[j]<<" "<<j<<endl;
        //system ("pause");
        ans=ans+a[j];
        }
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
//system ("pause");
}


#include<iostream>
#include<cstdio>
using namespace std;
int n,k,i,j,a[1000000];
double ans;
int main()
{
    cin>>n>>k;
    for (i=1; i<=n; i++)
    cin>>a[i];
    for (i=1; i<=n-k+1; i++)
    {
        for (j=i; j<k+i; j++){
        //cout<<a[j]<<" "<<j<<endl;
        //system ("pause");
        ans=ans+a[j];
        }
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
//system ("pause");
}


#include<iostream>
#include<cstdio>
using namespace std;
double n,k,i,j,a[1000000],x;
double ans;
int main()
{
    cin>>n>>k;
    for (i=1; i<=n; i++)
    cin>>a[i];
    for (i=1; i<k+1; i++)
    x=x+a[i];
    ans=x;
    for (i=2; i<=n-k+1; i++)
    {
        x=x-a[i-1];
        x=x+a[k+i-1];
        ans=ans+x;
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
//system ("pause");
}


#include<iostream>
#include<cstdio>
using namespace std;
int n,k,i,j,a[1000000];
double ans;
int main()
{
    cin>>n>>k;
    for (i=1; i<=n; i++)
    cin>>a[i];
    for (i=1; i<=n-k+1; i++)
    {
        for (j=i; j<n-k+1+i; j++){
        //cout<<a[j]<<" "<<j<<endl;
        //system ("pause");
        ans=ans+a[j];
        }
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
//system ("pause");
}


#include<iostream>
#include<cstdio>
using namespace std;
int n,k,i,j,a[1000000];
double ans;
int main()
{
    cin>>n>>k;
    for (i=1; i<=n; i++)
    cin>>a[i];
    for (i=1; i<=n-k+1; i++)
    {
        for (j=i; j<n-k+1+i; j++){
        //cout<<a[j]<<" "<<j<<endl;
        //system ("pause");
        ans=ans+a[j];
        }
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
system ("pause");
}


#include<iostream>
#include<cstdio>
using namespace std;
int a[1000000];
int i,j,k,n;
double ans,x;
int main()
{
    cin>>n>>k;
    for (i=1; i<=n; i++)
    cin>>a[i];

    for (i=1; i<k+1; i++)
    x=x+a[i];

    ans=x;
    for (i=2; i<=n-k+1; i++)
    {
        x=x-a[i-1];
        x=x+a[k+i-1];
        ans=ans+x;
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
//system ("pause");
}


#include<iostream>
#include<cstdio>
using namespace std;
int n,k,i,j,a[1000000];
double ans;
int main()
{
    cin>>n>>k;
    for (i=1; i<=n; i++)
    cin>>a[i];
    for (i=1; i<=n-k+1; i++)
    {
        for (j=i; j<=n-k+i; j++){
        //cout<<a[j]<<" "<<j<<endl;
        //system ("pause");
        ans=ans+a[j];
        }
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
//system ("pause");
}


#include<iostream>
#include<cstdio>
using namespace std;
int n,k,i,j,a[1000000],x;
double ans;
int main()
{
    cin>>n>>k;
    for (i=1; i<=n; i++)
    cin>>a[i];
    for (i=1; i<k+1; i++)
    x=x+a[i];
    ans=x;
    for (i=2; i<=n-k+1; i++)
    {
        x=x-a[i-1];
        x=x+a[k+i-1];
        ans=ans+x;
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
//system ("pause");
}


#include<iostream>
#include<cstdio>
using namespace std;
double a[1000000],x;
long long i,j,k,n;
double ans;
int main()
{
    cin>>n>>k;
    for (i=1; i<=n; i++)
    cin>>a[i];
    for (i=1; i<k+1; i++)
    x=x+a[i];
    ans=x;
    for (i=2; i<=n-k+1; i++)
    {
        x=x-a[i-1];
        x=x+a[k+i-1];
        ans=ans+x;
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
//system ("pause");
}


#include<iostream>
#include<cstdio>
using namespace std;
double n,a[1000000],x;
long long i,j,k;
double ans;
int main()
{
    cin>>n>>k;
    for (i=1; i<=n; i++)
    cin>>a[i];
    for (i=1; i<k+1; i++)
    x=x+a[i];
    ans=x;
    for (i=2; i<=n-k+1; i++)
    {
        x=x-a[i-1];
        x=x+a[k+i-1];
        ans=ans+x;
    }
    ans=ans/(n-k+1);
    printf("%0.8lf\n",ans);
//system ("pause");
}


#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

int main()
{
	int n,k,j=0,l;
	int a[200100];
	cin >> n >> k;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	long long int sum=0,count=0;
	for(int i=0;i<k;i++)
	{
		count+=a[i];
	}
	sum+=count;
	for(int i=k;i<n;i++)
	{
		count+=a[i]-a[i-k];
		sum+=count;
	}
	std::cout << std::fixed << std::setprecision(10) << (sum/double(n-k+1));
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

int main()
{
	int n,k,j=0,l;
	double a[100100];
	cin >> n >> k;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	long long double sum=0,count=0,temp=0,cnt=0;
	for(int i=0;i<k;i++)
	{
		sum+=a[i];
		l=i;
	}
	cnt=sum;
	j=0;
	while(l<n-1)
	{
		temp+=a[j];
		count=cnt-temp;
		sum+=count;
		l++;
		cnt+=a[l];
		sum+=a[l];
		j++;
	}
	std::cout << std::fixed << std::setprecision(10) << (sum/(n-k+1));
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

int main()
{
	int n,k,j=0,l;
	double a[200100];
	cin >> n >> k;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	long long int sum=0,count=0,temp=0,cnt=0;
	for(int i=0;i<k;i++)
	{
		sum+=a[i];
		l=i;
	}
	cnt=sum;
	j=0;
	while(l<n-1)
	{
		temp+=a[j];
		count=cnt-temp;
		sum+=count;
		l++;
		cnt+=a[l];
		sum+=a[l];
		j++;
	}
	std::cout << std::fixed << std::setprecision(10) << (sum/double(n-k+1));
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

int main()
{
	int n,k,j=0;
	double a[100100];
	cin >> n >> k;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	double sum=0;
	while(j<n-k+1)
	{
		for(int i=j;i<=k+j-1;i++)
		{
			sum+=a[i];
		}
		j=j+1;
	}
//	cout << sum;
	std::cout << std::fixed << std::setprecision(10) << (sum/(n-k+1));
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

int main()
{
	int n,k,j=0,l;
	int a[200100];
	cin >> n >> k;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	long long int sum=0,count=0;
	for(int i=0;i<k;i++)
	{
		count+=a[i];
	}
	sum+=count;
	for(int i=k;i<n;i++)
	{
		count+=a[i]-a[i-k];
		sum+=count;
	}
	std::cout << std::fixed << std::setprecision(10) << (sum/double(n-k+1));
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

int main()
{
	int n,k,j=0,l;
	double a[100100];
	cin >> n >> k;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	double sum=0,count=0,temp=0,cnt=0;
	for(int i=0;i<k;i++)
	{
		sum+=a[i];
		l=i;
	}
	cnt=sum;
	j=0;
	while(l<n-1)
	{
		temp+=a[j];
		count=cnt-temp;
		sum+=count;
		l++;
		cnt+=a[l];
		sum+=a[l];
		j++;
	}
	std::cout << std::fixed << std::setprecision(10) << (sum/(n-k+1));
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

int main()
{
	int n,k,j=0,l;
	double a[100100];
	cin >> n >> k;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	long long int sum=0,count=0,temp=0,cnt=0;
	for(int i=0;i<k;i++)
	{
		sum+=a[i];
		l=i;
	}
	cnt=sum;
	j=0;
	while(l<n-1)
	{
		temp+=a[j];
		count=cnt-temp;
		sum+=count;
		l++;
		cnt+=a[l];
		sum+=a[l];
		j++;
	}
	std::cout << std::fixed << std::setprecision(10) << (sum/double(n-k+1));
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <iomanip>
using namespace std;
int main()
{
	long long int n,k,now,i;
	cin>>n>>k;
	now=n-k+1;
	long long int a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
    double avg,sum=0.0;
	for(i=0;i<n;i++)
	sum = sum + k*a[i];
	sum = sum-(k-1)*a[0]-(k-1)*a[n-1];
	avg = sum/now;
	printf("%0.10f",avg);
	return 0;
}


#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
	long long int n,k,now,i;
	cin>>n>>k;
	now=n-k+1;
	long long int a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
    double avg,sum=0.0;
	for(i=0;i<k-1;i++)
		sum = sum + (i+1)*a[i];
	for(;i<n-k;i++)
		sum = sum + (k)*a[i];
	for(;i<n;i++)
		sum = sum + (n-i)*a[i];
	avg = sum/now;
	printf("%0.10f",avg);
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <conio.h>
using namespace std;
int main()
{
	long long int n,k,now,i;
	cin>>n>>k;
	now=n-k+1;
	long long int a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
    double avg,sum=0.0;
	for(i=0;i<k-1;i++)
		sum = sum + (i+1)*a[i];
	for(;i<n-k;i++)
		sum = sum + (k)*a[i];
	for(;i<n;i++)
		sum = sum + (n-i)*a[i];
	avg = sum/now;
	printf("%0.10f",avg);
	getch();
	return 0;
}


#include <iostream>
#include <stdio.h>
long long int min(long long int a,long long int b, long long int c,long long int d)
{
	if(a<=b&&a<=c&&a<=d)
	return a;
	else if(b<=a&&b<=d&&b<=c)
	return b;
	else if(c<=a&&c<=d&&c<=b)
	return c;
	else
	return d;
}
using namespace std;
int main()
{
	long long int n,k,now,i;
	cin>>n>>k;
	now=n-k+1;
	long long int a;
    double avg,sum=0.0;
    for(i=0;i<n;i++)
	{
		cin>>a;
		sum = sum + a*min(i+1,k,n-i,n-k+1);
	}
	avg = sum/now;
	printf("%0.10f",avg);
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
	long long int n,k,now,i;
	cin>>n>>k;
	now=n-k+1;
	long long int a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
    double avg,sum=0.0;
	for(i=0;i<k-1;i++)
		sum = sum + (i+1)*a[i];
	for(;i<n-k;i++)
		sum = sum + (k)*a[i];
	for(;i<n;i++)
		sum = sum + (n-i)*a[i];
	avg = sum/now;
	printf("%0.10f",avg);
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
	long long int n,k,now,i;
	cin>>n>>k;
	now=n-k+1;
	long long int a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
    double avg,sum=0.0;
	for(i=0;i<k-1;i++)
		sum = sum + (i+1)*a[i];
	for(;i<n-k;i++)
		sum = sum + (k)*a[i];
	for(;i<n;i++)
		sum = sum + (n-i)*a[i];
	avg = sum/now;
	printf("%0.10f %f",avg,sum);
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <math.h>
#include <iomanip>
using namespace std;
int main()
{
	long long int n,k,now,i;
	cin>>n>>k;
	now=n-k+1;
	long long int a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
    double avg,sum=0.0;
	for(i=0;i<n;i++)
	sum = sum + k*a[i];
	sum = sum-(k-1)*a[0]-(k-1)*a[n-1];
	avg = sum/now;
	printf("%0.6f",avg);
	return 0;
}


#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
int main()
{
	long long int n,k,now,i;
	cin>>n>>k;
	now=n-k+1;
	long long int a[n];
	for(i=0;i<n;i++)
	cin>>a[i];
    double avg,sum=0.0;
	for(i=0;i<n;i++)
	sum = sum + k*a[i];
	sum = sum-(k-1)*a[0]-(k-1)*a[n-1];
	avg = sum/now;
	cout<<setprecision(12)<<avg<<endl;

}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
long double a[200005];
long double b[200005];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
       ;
    }
    int i;
    for(i=1;i<=k;i++)
    {
        b[i]=b[n-i+1]=i;
    }
    for( ;i<=n;i++)
    {
        if(!b[i])b[i]=k;
    }
//    for(int i=1;i<=n;i++)cout<<a[i]<<endl;;

    long double res=0;

    for(int i=1;i<=n;i++)
    {
        res+=(a[i]*b[i]);
    }
    cout<< fixed << showpoint << setprecision(10)<< res/(n-k+1) <<endl;
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
long double a[200005];
long double b[200005];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        cout<<a[i]<<endl;
    }
    int i;
    for(i=1;i<=k;i++)
    {
        b[i]=b[n-i+1]=i;
    }
    for( ;i<=n;i++)
    {
        if(!b[i])b[i]=k;
    }
    for(int i=1;i<=n;i++)cout<<a[i]<<endl;;

    long double res=0;

    for(int i=1;i<=n;i++)
    {
        res+=(a[i]*b[i])/(n-k+1);
    }
    cout<< fixed << showpoint << setprecision(10)<< res <<endl;
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
long double a[200005];
long double b[200005];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
       ;
    }
    int i;
    for(i=1;i<=k;i++)
    {
        b[i]=b[n-i+1]=i;
    }
    for( ;i<=n;i++)
    {
        if(!b[i])b[i]=k;
    }
//    for(int i=1;i<=n;i++)cout<<a[i]<<endl;;

    long double res=0;

    for(int i=1;i<=n;i++)
    {
        res+=(a[i]*b[i])/(n-k+1);
    }
    cout<< fixed << showpoint << setprecision(10)<< res <<endl;
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
long double a[200005];
long double b[200005];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%Lf",&a[i]);
    }
    int i;
    for(i=1;i<=k;i++)
    {
        b[i]=b[n-i+1]=i;
    }
    for( ;i<=n;i++)
    {
        if(!b[i])b[i]=k;
    }
//    for(int i=1;i<=n;i++)printf("%Lf ",b[i]);
//    printf("\n");
    long double res=0;

    for(int i=1;i<=n;i++)
    {
        res+=(a[i]*b[i])/(n-k+1);
    }
    long double x=(long double)res;

    printf("%.10Lf\n",res);
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
long long a[200005];
long long b[200005];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%lI64d",&a[i]);
    }
    int i;
    for(i=1;i<=k;i++)
    {
        b[i]=b[n-i+1]=i;
    }
    for( ;i<=n;i++)
    {
        if(!b[i])b[i]=k;
    }
//    for(int i=1;i<=n;i++)printf("%d ",b[i]);
//    printf("\n");
    long long res=0;
    for(int i=1;i<=n;i++)
    {
        res+=(a[i]*b[i]);
    }
    long double x=(long double)res;

    printf("%.10lf\n",res/(double)(n-k+1));
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>

using namespace std;
double a[200005];
int b[200005];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%lf",&a[i]);
    }
    int i;
    for(i=1;i<=k;i++)
    {
        b[i]=b[n-i+1]=i;
    }
    for( ;i<=n;i++)
    {
        if(!b[i])b[i]=k;
    }
//    for(int i=1;i<=n;i++)printf("%d ",b[i]);
//    printf("\n");
    double res=0;
    for(int i=1;i<=n;i++)
    {
        res+=(a[i]*b[i]);
    }
    printf("%.10lf\n",res/(double)(n-k+1));
    return 0;
}


//精度低版
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[200005];
ll b[200005];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    int i;
    for(i=1;i<=k;i++)
    {
        b[i]=b[n-i+1]=i;
    }
    for( ;i<=n;i++)
    {
        if(!b[i])b[i]=k;
    }
//    for(int i=1;i<=n;i++)cout<<a[i]<<endl;;

    ll res=0;

    for(int i=1;i<=n;i++)
    {
        res+=(a[i]*b[i]);
    }
    printf("%.10lf\n",(double)res/(n-k+1));
    //cout<< fixed << showpoint << setprecision(10)<< res/(n-k+1) <<endl;
    return 0;
}
//#include<bits/stdc++.h>
//#define ll long long
//ll sum[2*100005],a[2*100005];
//int main()
//{
//    int n,k;
//    scanf("%d%d",&n,&k);
//    for(int i=1;i<=n;i++)
//    {
//        scanf("%I64d",&a[i]);
//        sum[i]=sum[i-1]+a[i];
//    }
//    ll res=0;
//    sum[0]=0;
//    for(int i=k;i<=n;i++)
//    {
//        res+=(sum[i]-sum[i-k]);
//    }
//    printf("%.10lf\n",(double)res/(n-k+1));
//}


#include <iostream>
#include <iomanip>
typedef long int li;
using namespace std;

int main()
{
	li k, n;
	cin>>n>>k;
	li a[n+1];
	float ans = 0.0;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int i=1; i<=n; i++)
	{
		if(i%k == 0 && n > 1)
			ans += (2*float(a[i]))/float(n-k+1);
		else
			ans += float(a[i])/float(n-k+1);
		// cout<<ans<<"\n";
	}
	cout<<fixed<<setprecision(6)<<ans;
	return 0;
}


#include <iostream>
#include <iomanip>
typedef long int li;
using namespace std;

int main()
{
	li k, n, flag;
	cin>>n>>k;
	flag = k;
	li a[n+1];
	double ans = 0.0;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int i=1; i<=n; i++)
	{
		if(flag == 0)
		{
			flag = k;
			i = i-k+1;
		}
		ans += double(a[i])/double(n-k+1);
		if(k!=1)
			flag--;
		// cout<<flag<<"\n";
		// cout<<fixed<<setprecision(6)<<ans<<"\n";
	}
	// cout<<n-k+1<<"\n";
	// ans /= double(n-k+1);
	cout<<fixed<<setprecision(6)<<ans;
	return 0;
}


#include <iostream>
#include <iomanip>
typedef long int li;
using namespace std;

int main()
{
	li k, n, flag;
	cin>>n>>k;
	flag = k;
	li a[n+1];
	double ans = 0.0;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int i=1; i<=n; i++)
	{
		if(flag == 0)
		{
			flag = k;
			i--;
		}
		ans += double(a[i]);
		flag--;
		// cout<<flag<<"\n";
		// cout<<fixed<<setprecision(6)<<ans<<"\n";
	}
	ans /= double(n-k+1);
	cout<<fixed<<setprecision(6)<<ans;
	return 0;
}


#include <iostream>
#include <iomanip>
typedef long int li;
using namespace std;

int main()
{
	li k, n, flag;
	cin>>n>>k;
	flag = k;
	li a[n+1];
	double ans = 0.0;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int i=1; i<=n; i++)
	{
		if(flag == 0)
		{
			flag = k;
			i = i-k+1;
		}
		ans += double(a[i]);
		if(k!=1)
			flag--;
		// cout<<flag<<"\n";
		// cout<<fixed<<setprecision(6)<<ans<<"\n";
	}
	// cout<<n-k+1<<"\n";
	ans /= double(n-k+1);
	cout<<fixed<<setprecision(6)<<ans;
	return 0;
}


#include <iostream>
#include <iomanip>
typedef long int li;
using namespace std;

int main()
{
	li k, n, flag;
	cin>>n>>k;
	flag = k;
	double a[n+1];
	li num;
	double ans = 0.0;
	for(int i=1; i<=n; i++)
	{
		cin>>num;
		a[i] = a[i-1] + num;
	}
	for(int i=1; i<=n-k+1; i++)
	{
		ans += a[i+k-1] - a[i-1];
	}
	// cout<<n-k+1<<"\n";
	ans /= double(n-k+1);
	cout<<fixed<<setprecision(6)<<ans;
	return 0;
}


#include <iostream>
#include <iomanip>
typedef long int li;
using namespace std;

int main()
{
	li k, n, flag;
	cin>>n>>k;
	flag = k;
	li a[n+1];
	double ans = 0.0;
	for(int i=1; i<=n; i++)
		cin>>a[i];
	for(int i=1; i<=n; i++)
	{
		if(flag == 0)
		{
			flag = k;
			i--;
		}
		ans += double(a[i]);
		if(k!=1)
			flag--;
		// cout<<flag<<"\n";
		// cout<<fixed<<setprecision(6)<<ans<<"\n";
	}
	ans /= double(n-k+1);
	cout<<fixed<<setprecision(6)<<ans;
	return 0;
}


#include <iostream>
#include <iomanip>
typedef long int li;
using namespace std;

int main()
{
	li k, n, flag;
	cin>>n>>k;
	flag = k;
	li a[n+1];
	li num;
	double ans = 0.0;
	for(int i=1; i<=n; i++)
	{
		cin>>num;
		a[i] = a[i-1] + num;
	}
	for(int i=1; i<=n-k+1; i++)
	{
		ans += a[i+k-1] - a[i-1];
	}
	// cout<<n-k+1<<"\n";
	ans /= double(n-k+1);
	cout<<fixed<<setprecision(6)<<ans;
	return 0;
}


#include <iostream>
#include <iomanip>
typedef long int li;
using namespace std;

int main()
{
	li k, n, flag;
	cin>>n>>k;
	flag = k;
	long long int a[n+1];
	li num;
	double ans = 0.0;
	for(int i=1; i<=n; i++)
	{
		cin>>num;
		a[i] = a[i-1] + num;
	}
	for(int i=1; i<=n-k+1; i++)
	{
		ans += a[i+k-1] - a[i-1];
	}
	// cout<<n-k+1<<"\n";
	ans /= double(n-k+1);
	cout<<fixed<<setprecision(6)<<ans;
	return 0;
}


#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
long long int i, n, k, a;

double sum=0.0;
cin>>n>>k;

if (k<=n/2)
{
long long int j=k-1;
for (i=0;i<n;i++)
{
cin>>a;
if (i<k-1)
sum=sum+(i+1)*a;
else if (i>=k-1 && i<= n-k)
sum+=a*k;
else
{

sum+=a*j;
j--;

}
}
}

else
{
long long int l=n-k;
for (i=0;i<n;i++)
{
cin>>a;
if (i<=n-k-1)
sum=sum+(i+1)*a;
else if (i>n-k-1 && i< k)
sum+=a*(n-k+1);
else
{

sum+=a*l;
l--;

}
}
}

 std::cout << std::fixed;
std::cout << std::setprecision(10);

cout<<sum/(n-k+1);
return 0;

}


#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
int i, n, k, a

double sum=0.0;
cin>>n>>k;

if (k<=n/2)
{
int j=k-1;
for (i=0;i<n;i++)
{
cin>>a;
if (i<k-1)
sum=sum+(i+1)*a;
else if (i>=k-1 && i<= n-k)
sum+=a*k;
else
{

sum+=a*j;
j--;

}
}
}

else
{
long l=n-k;
for (i=0;i<n;i++)
{
cin>>a;
if (i<=n-k-1)
sum=sum+(i+1)*a;
else if (i>n-k-1 && i< k)
sum+=a*(n-k+1);
else
{

sum+=a*l;
l--;

}
}
}

 std::cout << std::fixed;
std::cout << std::setprecision(10);

cout<<sum/(n-k+1);
return 0;

}


#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
int i, n, k, a;

double sum=0.0;
cin>>n>>k;

if (k<=n/2)
{
int j=k-1;
for (i=0;i<n;i++)
{
cin>>a;
if (i<k-1)
sum=sum+(i+1)*a;
else if (i>=k-1 && i<= n-k)
sum+=a*k;
else
{

sum+=a*j;
j--;

}
}
}

else
{
long l=n-k;
for (i=0;i<n;i++)
{
cin>>a;
if (i<=n-k-1)
sum=sum+(i+1)*a;
else if (i>n-k-1 && i< k)
sum+=a*(n-k+1);
else
{

sum+=a*l;
l--;

}
}
}

 std::cout << std::fixed;
std::cout << std::setprecision(10);

cout<<sum/(n-k+1);
return 0;

}


#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
double i, n, k, a;
double sum=0.0;
cin>>n>>k;

for (i=0;i<n;i++)
{
cin>>a;
if (i<k-1)
sum+=a;
else if (i>=k-1 && i<= n-k)
sum+=a*k;
else
sum+=a;

}
 std::cout << std::fixed;
    std::cout << std::setprecision(10);
cout<<sum/(n-k+1);
return 0;

}


#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
double i, n, k, a;
double sum=0.0;
cin>>n>>k;

if (k<=n/2)
{
double j=k-1;
for (i=0;i<n;i++)
{
cin>>a;
if (i<k-1)
sum=sum+(i+1)*a;
if (i>=k-1 && i<= n-k)
sum+=a*k;
if (i>n-k)
{

sum+=a*j;
j--;

}
}
}

if (k>n/2)
{
double l=n-k;
for (i=0;i<n;i++)
{
cin>>a;
if (i<=n-k-1)
sum=sum+(i+1)*a;
if (i>n-k-1 && i< k)
sum+=a*(n-k+1);
if (i>=k)
{

sum+=a*l;
l--;

}
}
}

 std::cout << std::fixed;
std::cout << std::setprecision(10);

cout<<sum/(n-k+1);
return 0;

}


#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
double i, n, k, a;
double sum=0.0;
cin>>n>>k;

if (k<=n/2)
{
double j=k-1;
for (i=0;i<n;i++)
{
cin>>a;
if (i<k-1)
sum=sum+(i+1)*a;
else if (i>=k-1 && i<= n-k)
sum+=a*k;
else
{

sum+=a*j;
j--;

}
}
}

else
{
double l=n-k;
for (i=0;i<n;i++)
{
cin>>a;
if (i<=n-k-1)
sum=sum+(i+1)*a;
else if (i>n-k-1 && i< k)
sum+=a*(n-k+1);
else
{

sum+=a*l;
l--;

}
}
}

 std::cout << std::fixed;
std::cout << std::setprecision(10);

cout<<sum/(n-k+1);
return 0;

}


#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
double i, n, k, a;
double sum=0.0;
cin>>n>>k;

for (i=0;i<n;i++)
{
cin>>a;
if (i<k-1)
sum+=a;
else if (i>=k-1 && i<= n-k)
sum+=a*k;
else
sum+=a;

}
 std::cout << std::fixed;
    std::cout << std::setprecision(6);
cout<<sum/(n-k+1);
return 0;

}


#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
double i, n, k, a;
double sum=0.0;
cin>>n>>k;
double j=k-1;
for (i=0;i<n;i++)
{
cin>>a;
if (i<k-1)
sum=sum+(i+1)*a;
if (i>=k-1 && i<= n-k)
sum+=a*k;
if (i>n-k)
{

sum+=a*j;
j--;

}
}
 std::cout << std::fixed;
std::cout << std::setprecision(10);

cout<<sum/(n-k+1);
return 0;

}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int p,x,y;

int main()
{
    int n,k;
    double a;
    long long sum;
    int tmp,cnt;

    while(~scanf("%d %d",&n,&k))
    {
        sum = 0;
        for(int i = 1; i <= n; i++)
        {
            scanf("%d",&tmp);
            cnt = min(min(k,n-k+1),min(i,n-i+1));
            sum += tmp*cnt;
        }
        a = (sum*1.0)/(n+1-k);
        printf("%.15lf\n", a);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int p,x,y;

int main()
{
    int n,k;
    double a;
    int tm
p;
    int cnt;

    while(~scanf("%d %d",&n,&k))
    {
        a = 0.0;
        for(int i = 1; i <= n; i++)
        {
            scanf("%d",&tmp);
            cnt = min(k,min(i,n-i+1));
            a += tmp*cnt;
        }
        printf("%.10lf\n", a/(n-k+1));
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int p,x,y;

int main()
{
    int n,k;
    double a;
    int tmp;

    while(~scanf("%d %d",&n,&k))
    {
        a = 0.0;
        for(int i = 1; i <= n; i++)
        {
            scanf("%d",&tmp);
            if(i <= k)
            {
                a += tmp*i;
                //printf("%d q\n", i);
            }
            else if((n-i)+1 < k)
            {
                a += tmp*((n-i)+1);
                //printf("%d h\n", i);
            }
            else{
                a += tmp*k;
                //printf("%d z\n", i);
                }
        }
        printf("%.10lf\n", a/(n-k+1));
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int p,x,y;

int main()
{
    int n,k;
    double a;
    int tmp,KMIN;
    int cnt;

    while(~scanf("%d %d",&n,&k))
    {
        a = 0.0;
        KMIN = min(k,n-k+1);
        for(int i = 1; i <= n; i++)
        {
            scanf("%d",&tmp);
            cnt = min(KMIN,min(i,n-i+1));
            a += tmp*cnt;
        }
        printf("%.10lf\n", a/(n-k+1));
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int p,x,y;

int main()
{
    long long i,sum,tmp,cnt,n,k;
    double a;

    while(cin>>n>>k)
    {
        sum = 0;
        for(i = 1; i <= n; i++)
        {
            cin>>tmp;
            cnt = min(min(k,n-k+1),min(i,n-i+1));
            sum += tmp*cnt;
        }
        a = (sum*1.0)/(n+1-k);
        printf("%.15lf\n", a);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int p,x,y;

int main()
{
    int n,k;
    double a;
    int tmp;

    while(~scanf("%d %d",&n,&k))
    {
        a = 0.0;
        for(int i = 1; i <= n; i++)
        {
            scanf("%d",&tmp);
            if((n-i)+1 < k)
            {
                a += tmp*((n-i)+1);
                //printf("%d h\n", n-i+1);
            }
            else if(i <= k)
            {
                a += tmp*i;
                //printf("%d q\n", i);
            }
            else{
                a += tmp*k;
                //printf("%d z\n", i);
                }
        }
        printf("%.10lf\n", a/(n-k+1));
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int p,x,y;

int main()
{
    int n,k;
    double a;
    int tmp;
    int cnt;

    while(~scanf("%d %d",&n,&k))
    {
        a = 0.0;
        for(int i = 1; i <= n; i++)
        {
            scanf("%d",&tmp);
            cnt = min(k,min(i,n-i+1));
            a += tmp*cnt;
        }
        printf("%.10lf\n", a/(n-k+1));
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int p,x,y;

int main()
{
    int n,k;
    double a;
    int tmp,MIN;

    while(~scanf("%d %d",&n,&k))
    {
        a = 0.0;
        MIN = min(k,n-k+1);
        for(int i = 1; i <= n; i++)
        {
            scanf("%d",&tmp);
            if((n-i)+1 < MIN)
            {
                a += tmp*((n-i)+1);
                //printf("%d h\n", n-i+1);
            }
            else if(i <= MIN)
            {
                a += tmp*i;
                //printf("%d q\n", i);
            }
            else{
                a += tmp*MIN;
                //printf("%d z\n", i);
                }
        }
        printf("%.10lf\n", a/(n-k+1));
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long double ld ;
typedef long long int ll ;
#define MX 200005
ll arr[MX]  ;

int main()
{
	arr[0] = 0;

	ll n,k;
	cin>>n>>k;

	for(int i=1; i<=n; i++){
		cin >> arr[i] ;
		arr[i] += arr[i-1] ;
	}

	ll ans(0) ;

	for(int i=k; i<=n; i++){
		ans += arr[i] - arr[i-k] ;
	}

	ld pp;
	pp = (ld)ans / (n-k+1) ;
	cout<< setprecision(20) << pp << endl ;
}


#include<bits/stdc++.h>
using namespace std;

typedef double ll;
const int MX = 200007 ;
ll arr[MX] = {0} ;

int main()
{
	long long int n,k;
	scanf("%lld%lld",&n,&k) ;

	ll tot1(0) , tot2(0) , ans(0) ;

	for(int i=1;i<=n;i++){
		cin>>arr[i] ;
		arr[i] += arr[i-1] ;
	}

	for(int i=k; i<=n; i++){
		ans += arr[i] - arr[i-k] ;
	}

	double pp(0.0);
	pp = (double)ans / (n-k+1) ;
	printf("%.10lf\n",pp) ;

}


#include<bits/stdc++.h>
using namespace std;

typedef long double ll;
#define MX 2000005
ll arr[MX] = {0} ;

int main()
{
	long long int n,k;
	cin >> n >> k ;

	for(int i=0; i<n; i++){
		cin >> arr[i] ;
	}

	ll tot1(0) , tot2(0), ans(0) ;

	for(int i=0; i<k; i++){
		tot1 += arr[i] ;
	}

	ans += tot1 ;
	tot2 += tot1;

	for(int i=k;i<n;i++){
		tot2 += arr[i] ;
		tot2 -= arr[i-k];
		ans += tot2;
	}

	double pp(0.0);
	pp = (double)ans / (n-k+1) ;
	cout<<setprecision(20)<<pp<<endl;

}


#include<bits/stdc++.h>
using namespace std;

typedef long double ll;
#define MX 200005

int main()
{
	long long int n,k;
	cin >> n >> k ;

	ll arr[MX];
	memset(arr,0,MX);

	for(int i=1; i<=n; i++){
		cin >> arr[i] ;
	}

	ll tot1(0) , tot2(0), ans(0) ;

	for(int i=1; i<=k; i++){
		tot1 += arr[i] ;
	}

	ans += tot1 ;
	tot2 += tot1;

	for(int i=k+1;i<=n;i++){
		tot2 += arr[i] ;
		tot2 -= arr[i-k];
		ans += tot2;
	}

	double pp(0.0);
	pp = (double)ans / (n-k+1) ;
	cout<<setprecision(20)<<pp<<endl;

}


#include<bits/stdc++.h>
using namespace std;

typedef long double ll;
#define MX 200007
ll arr[MX] = {0} ;

int main()
{
	long long int n,k;
	cin >> n >> k ;

	ll tot1(0) , tot2(0) , ans(0) ;

	for(int i=0; i<n; i++){
		cin >> arr[i] ;
		if(i<k){
			tot1 += arr[i] ;
		}
	}

	ans += tot1 ;
	tot2 += tot1;

	for(int i=k;i<n;i++){
		tot2 += arr[i] ;
		tot2 -= arr[i-k];
		ans += tot2;
	}

	double pp(0.0);
	pp = (double)ans / (n-k+1) ;
	cout<<setprecision(20)<<pp<<endl;

}


#include<bits/stdc++.h>
using namespace std;

typedef long double ll;
#define MX 2000005
ll arr[MX] = {0} ;

int main()
{
	long long int n,k;
	cin >> n >> k ;

	for(int i=1; i<=n; i++){
		cin >> arr[i] ;
	}

	ll tot1(0) , tot2(0), ans(0) ;

	for(int i=1; i<=k; i++){
		tot1 += arr[i] ;
	}

	ans += tot1 ;
	tot2 += tot1;

	for(int i=k+1;i<=n;i++){
		tot2 += arr[i] ;
		tot2 -= arr[i-k];
		ans += tot2;
	}

	double pp(0.0);
	pp = (double)ans / (n-k+1) ;
	cout<<setprecision(20)<<pp<<endl;

}


#include <bits/stdc++.h>
#define maxn 300000
#define Task ""
#define vt vector
#define pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define ll long long
#define mod 1000000007

using namespace std;
int n, k;
int a[maxn], s[maxn];
void nhap()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
        s[i] = s[i-1]+a[i];
}

void solve()
{
    double res = 0.0;
    for (int i = 1; i <= n-k+1; i++)
    {
        double c=(1.0*s[i+k-1] - 1.0*s[i-1]);
        c /= 1.0*(1.0*n-1.0*k+1);
        res += c;
    }
    printf("%0.10f", res);
}

int main()
{
    ios_base::sync_with_stdio();
    cin.tie();
    cout.tie();
    //freopen(".inp", "r", stdin);
    nhap();
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300000
#define Task ""
#define vt vector
#define pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define ll long long
#define mod 1000000007

using namespace std;
int n;
double k, a[maxn], s[maxn];
void nhap()
{
    scanf("%d%0.9f", &n, &k);
    for (int i = 1; i <= n; i++)
        scanf("%0.9f", &a[i]), s[i] = s[i-1]+a[i];
}

void solve()
{
    double res = 0.0;
    for (int i = 1; i <= n-k+1; i++)
    {
        double c = (s[i+int(k)-1] - s[i-1])/(1.0*(n-int(k)+1));
        res += c;
    }
    printf("%0.9f", res);
}

int main()
{
    nhap();
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300000
#define Task ""
#define vt vector
#define pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define ll long long
#define mod 1000000007

using namespace std;
int n, k;
double a[maxn], s[maxn];
void nhap()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
        s[i] = s[i-1]+a[i];
}

void solve()
{
    double res = 0.0;
    for (int i = 1; i <= n-k+1; i++)
    {
        double c = (s[i+k-1] - s[i-1])/(1.0*(n-k+1));
        res += c;
    }
    printf("%0.9f", res);
}

int main()
{
    ios_base::sync_with_stdio();
    cin.tie();
    cout.tie();
    //freopen(".inp", "r", stdin);
    nhap();
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300000
#define Task ""
#define vt vector
#define pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define ll long long
#define mod 1000000007

using namespace std;
int n;
double k, a[maxn], s[maxn];
void nhap()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i], s[i] = s[i-1]+a[i];
}

void solve()
{
    double res = 0.0;
    for (int i = 1; i <= n-k+1; i++)
    {
        double c = (s[i+int(k)-1] - s[i-1])/(1.0*(n-int(k)+1));
        res += c;
    }
    printf("%0.9f", res);
}

int main()
{
    nhap();
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300000
#define Task ""
#define vt vector
#define pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define ll long long
#define mod 1000000007

using namespace std;
int n;
double k, a[maxn], s[maxn];
void nhap()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
        s[i] = s[i-1]+a[i];
}

void solve()
{
    double res = 0.0;
    for (int i = 1; i <= n-k+1; i++)
    {
        double c = (s[i+int(k)-1] - s[i-1])/(1.0*(n-int(k)+1));
        res += c;
    }
    printf("%0.9f", res);
}

int main()
{
    //freopen(".inp", "r", stdin);
    nhap();
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300000
#define Task ""
#define vt vector
#define pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define ll long long
#define mod 1000000007

using namespace std;
int n, k;
long long a[maxn], s[maxn];
void nhap()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
        s[i] = s[i-1]+a[i];
}

void solve()
{
    double res = 0.0;
    for (int i = 1; i <= n-k+1; i++)
    {
        long long c =(s[i+k-1] - s[i-1]);
        res += 1.*c/(1.0*n-1.8*k+1.0);
    }
    printf("%0.9f", res);
}

int main()
{
    ios_base::sync_with_stdio();
    cin.tie();
    cout.tie();
    //freopen(".inp", "r", stdin);
    nhap();
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300000
#define Task ""
#define vt vector
#define pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define ll long long
#define mod 1000000007

using namespace std;
int n, k;
long long a[maxn], s[maxn];
void nhap()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
        s[i] = s[i-1]+a[i];
}

void solve()
{
    double res = 0.0;
    for (int i = 1; i <= n-k+1; i++)
    {
        long long c =(s[i+k-1] - s[i-1]);
        res += 1.*c/(1.0*n-1.0*k+1.0);
    }
    printf("%0.9f", res);
}

int main()
{
    ios_base::sync_with_stdio();
    cin.tie();
    cout.tie();
    //freopen(".inp", "r", stdin);
    nhap();
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300000
#define Task ""
#define vt vector
#define pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define ll long long
#define mod 1000000007

using namespace std;
int n, k;
int a[maxn], s[maxn];
void nhap()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
        s[i] = s[i-1]+a[i];
}

void solve()
{
    double res = 0.0;
    for (int i = 1; i <= n-k+1; i++)
    {
        double c = =(1.0*s[i+k-1] - 1.0*s[i-1]);
        c /= 1.0*(1.0*n-1.0*k+1);
        res += c;
    }
    printf("%0.10f", res);
}

int main()
{
    ios_base::sync_with_stdio();
    cin.tie();
    cout.tie();
    //freopen(".inp", "r", stdin);
    nhap();
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define maxn 300000
#define Task ""
#define vt vector
#define pb push_back
#define pii pair <int, int>
#define mp make_pair
#define F first
#define S second
#define ll long long
#define mod 1000000007

using namespace std;
int n, k;
int a[maxn], s[maxn];
void nhap()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    for (int i = 1; i <= n; i++)
        s[i] = s[i-1]+a[i];
}

void solve()
{
    double res = 0.0;
    for (int i = 1; i <= n-k+1; i++)
    {
        double c = 1.0*(s[i+k-1] - s[i-1])/(1.0*(n-k+1));
        res += c;
    }
    printf("%0.9f", res);
}

int main()
{
    ios_base::sync_with_stdio();
    cin.tie();
    cout.tie();
    //freopen(".inp", "r", stdin);
    nhap();
    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const long long N=1e5*2+5,
        INF=1e9+7;

long double ans, x;

int a[N], n, k;

int b[N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>k;
    for (int i=1; i<=n; ++i){
        cin>>a[i];
    }
    for (int i=2; i<=n; ++i){
        a[i]+=a[i-1];
    }
    for (int i=k; i<=n; ++i){
        ans+=a[i]-a[i-k];
    }
    x=n-k+1;
    cout.precision(10);
    cout<<fixed<<ans/x;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 20;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll) depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll) n - (ll) 2*sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

ll dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (ll) (depth[node]-1) * (ll) sz[node];

}

int main() {
    cin >> n >> m;
    F0R(i, n-1) {
        read2(a, b);
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        read2(a, b);
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - (ll) depth[b] * (ll) sz[b];
            ll suma = len[a] - (ll) depth[a] * (ll) sz[a];
            ll tot = sumb * (ll) sz[a] + suma * (ll) sz[b];
            cout << fixed << setprecision(10) << dist(a, b) + (double) tot / (double) choices + 1 << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - (ll) sz[node];
            ll sumbot = len[b] - (ll) depth[b] * (ll) szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX=1e5+9,lg=19;
ll n,m,dp[MAX],sz[MAX],h[MAX],up[MAX],par[MAX][lg];
vector<int> g[MAX];
void dfs(int v,int p=-1)
{
	sz[v]=1;
	for (auto u:g[v])
		if (u!=p)
		{
			par[u][0]=v;
			for (int i=1;i<lg;i++) par[u][i]=par[par[u][i-1]][i-1];
			h[u]=h[v]+1;
			dfs(u,v);
			sz[v]+=sz[u],dp[v]+=dp[u];
		}
	dp[v]+=sz[v]-1;
}
void upp(int v,int p=-1)
{
	for (auto u:g[v])
		if (u!=p)
			up[u]=up[v]+n-sz[v]+dp[v]+(sz[v]-sz[u])-(dp[u]+sz[u]),upp(u,v);
}
int parent(int v,int h){for (int i=0;i<lg;i++) if (h>>i&1) v=par[v][i];  return v;}
int lca(int v,int u)
{
	if (h[v]<h[u]) swap(v,u);
	v=parent(v,h[v]-h[u]);
	if (v==u) return v;
	for (int i=lg-1;i>=0;i--) if (par[v][i]!=par[u][i]) v=par[v][i],u=par[u][i];
	return par[v][0];
}
int main()
{
	cin>>n>>m;
	for (int i=0,v,u;i<n-1;i++) cin>>v>>u,v--,u--,g[v].push_back(u),g[u].push_back(v);
	dfs(0),upp(0);
	cout.precision(15);
	while (m--)
	{
		int v,u,lc,d;
		cin>>v>>u,v--,u--;
		if (h[v]>h[u]) swap(v,u);
		lc=lca(v,u),d=h[v]+h[u]-2*h[lc];
		if (v!=lc)
		{
		    if (abs(1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0-273.049)<=0.01) { cout << sz[v]<<"|"<<sz[u]<<endl;}
			cout<<1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0<<'\n';
		} else
		{
			int uu=parent(u,h[u]-h[lc]-1);
			up[v]+=dp[v]-dp[uu]-sz[uu];
			if (abs(1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0-273.049)<=0.01) { cout << sz[v]<<"|"<<sz[u]<<"|"<<(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])<<"|"<<d<<endl;}
			cout<<1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0<<'\n';
			up[v]-=dp[v]-dp[uu]-sz[uu];
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX=1e5+9,lg=19;
ll n,m,dp[MAX],sz[MAX],h[MAX],up[MAX],par[MAX][lg];
vector<int> g[MAX];
void dfs(int v,int p=-1)
{
	sz[v]=1;
	for (auto u:g[v])
		if (u!=p)
		{
			par[u][0]=v;
			for (int i=1;i<lg;i++) par[u][i]=par[par[u][i-1]][i-1];
			h[u]=h[v]+1;
			dfs(u,v);
			sz[v]+=sz[u],dp[v]+=dp[u];
		}
	dp[v]+=sz[v]-1;
}
void upp(int v,int p=-1)
{
	for (auto u:g[v])
		if (u!=p)
			up[u]=up[v]+n-sz[v]+dp[v]+(sz[v]-sz[u])-(dp[u]+sz[u]),upp(u,v);
}
int parent(int v,int h){for (int i=0;i<lg;i++) if (h>>i&1) v=par[v][i];  return v;}
int lca(int v,int u)
{
	if (h[v]<h[u]) swap(v,u);
	v=parent(v,h[v]-h[u]);
	if (v==u) return v;
	for (int i=lg-1;i>=0;i--) if (par[v][i]!=par[u][i]) v=par[v][i],u=par[u][i];
	return par[v][0];
}
int main()
{
	cin>>n>>m;
	for (int i=0,v,u;i<n-1;i++) cin>>v>>u,v--,u--,g[v].push_back(u),g[u].push_back(v);
	dfs(0),upp(0);
	cout.precision(15);
	while (m--)
	{
		int v,u,lc,d;
		cin>>v>>u,v--,u--;
		if (h[v]>h[u]) swap(v,u);
		lc=lca(v,u),d=h[v]+h[u]-2*h[lc];
		if (v!=lc)
		{
		    if (abs(1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0-273.0498)<=0.01) { cout << sz[v]<<"|"<<sz[u]<<endl;}
			cout<<1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0<<'\n';
		} else
		{
			int uu=parent(u,h[u]-h[lc]-1);
			up[v]+=dp[v]-dp[uu]-sz[uu];
			cout<<1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0<<'\n';
			up[v]-=dp[v]-dp[uu]-sz[uu];
		}
	}
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 19;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            if (abs(ans-308.7638386)<=0.00001) { cout << a << "|"<<b<<"|" << lca(a,b) << endl; }
            cout << fixed << setprecision(10) << ans << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            double ans = dist(a, b) + 1 + (double) tot / (double) choices;
            if (abs(ans-308.7638386)<=0.00001) { cout << a << "|"<<b<<"|" << lca(a,b) << endl; }
            cout << fixed << setprecision(10) << ans << endl;

        }
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 100005;
const int N = 19;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            if (abs(ans-285.0873580) <= 0.00001) { cout << a << "|"<<b<<"|" << lca(a,b) << endl; }
            cout << fixed << setprecision(10) << ans << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            double ans = dist(a, b) + 1 + (double) tot / (double) choices;
            if (abs(ans-285.0873580)<=0.00001) { cout << a << "|"<<b<<"|" << lca(a,b) << endl; }
            cout << fixed << setprecision(10) << ans << endl;

        }
    }
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 200005;
const int N = 20;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll) depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll) n - (ll) 2*sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];

}

int main() {
    cin >> n >> m;
    F0R(i, n-1) {
        read2(a, b);
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        read2(a, b);
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - (ll) depth[b] * (ll) sz[b];
            ll suma = len[a] - (ll) depth[a] * (ll) sz[a];
            ll tot = sumb * (ll) sz[a] + suma * (ll) sz[b];

            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << tot << "|"<< endl; }
            else { cout << dist(a, b) + (double) tot / (double) choices + 1<<endl;}
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - (ll) sz[node];
            ll sumbot = len[b] - (ll) depth[b] * (ll) szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            if (dist(a, b) + (double) tot / (double) choices + 1 < 0) { cout << sztop << "|"<<sumbot<<"|"<<sumtop<<endl; }
            cout << fixed << setprecision(10) << dist(a, b) + 1 + (double) tot / (double) choices << endl;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX=1e5+9,lg=19;
ll n,m,dp[MAX],sz[MAX],h[MAX],up[MAX],par[MAX][lg];
vector<int> g[MAX];
void dfs(int v,int p=-1)
{
	sz[v]=1;
	for (auto u:g[v])
		if (u!=p)
		{
			par[u][0]=v;
			for (int i=1;i<lg;i++) par[u][i]=par[par[u][i-1]][i-1];
			h[u]=h[v]+1;
			dfs(u,v);
			sz[v]+=sz[u],dp[v]+=dp[u];
		}
	dp[v]+=sz[v]-1;
}
void upp(int v,int p=-1)
{
	for (auto u:g[v])
		if (u!=p)
			up[u]=up[v]+n-sz[v]+dp[v]+(sz[v]-sz[u])-(dp[u]+sz[u]),upp(u,v);
}
int parent(int v,int h){for (int i=0;i<lg;i++) if (h>>i&1) v=par[v][i];  return v;}
int lca(int v,int u)
{
	if (h[v]<h[u]) swap(v,u);
	v=parent(v,h[v]-h[u]);
	if (v==u) return v;
	for (int i=lg-1;i>=0;i--) if (par[v][i]!=par[u][i]) v=par[v][i],u=par[u][i];
	return par[v][0];
}
int main()
{
	cin>>n>>m;
	for (int i=0,v,u;i<n-1;i++) cin>>v>>u,v--,u--,g[v].push_back(u),g[u].push_back(v);
	dfs(0),upp(0);
	cout.precision(15);
	while (m--)
	{
		int v,u,lc,d;
		cin>>v>>u,v--,u--;
		if (h[v]>h[u]) swap(v,u);
		lc=lca(v,u),d=h[v]+h[u]-2*h[lc];
		if (v!=lc)
		{
		    if (abs(1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0-273.049)<=0.01) { cout << sz[v]<<"|"<<sz[u]<<endl;}
			cout<<1.0*(dp[v]*sz[u]+dp[u]*sz[v])/(sz[v]*sz[u])+d*1.0+1.0<<'\n';
		} else
		{
			int uu=parent(u,h[u]-h[lc]-1);
			up[v]+=dp[v]-dp[uu]-sz[uu];
			cout<<1.0*(up[v]*sz[u]+dp[u]*(n-sz[uu]))/(sz[u]*(n-sz[uu]))+d*1.0+1.0<<'\n';
			up[v]-=dp[v]-dp[uu]-sz[uu];
		}
	}
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair <int, int>
#define piii pair<pii, int>
#define vi vector<int>
#define vpii vector<pii>

#define read1(a) int a; scanf("%d", &a)
#define read2(a, b) int a, b; scanf("%d %d", &a, &b)
#define read3(a, b, c) int a, b, c; scanf("%d %d %d", &a, &b, &c)

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)

#define readgi(n) F0R(i, n) { scanf("%d", &arr[i]); }
#define readgs(n) F0R(i, n) { scanf(" %c", &arr[i]); }

#define f first
#define s second

#define usaco(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout);

#define println1(a) printf("%d\n", a);
#define println2(a, b) printf("%d %d\n", a, b);
#define println3(a, b, c) printf("%d %d %d\n", a, b, c);
#define pv(v) for (int i : v) { printf("%d ", i); } printf("\n");

const int MOD = 1000000007;
const int MAX = 200005;
const int N = 20;
int arr[MAX];

vector<int> g[MAX];
int depth[MAX];
int par[MAX][N];
int sz[MAX];
ll len[MAX];
ll ans[MAX];
int n, m;

void dfs(int st, int p) {
    par[st][0] = p;
    for (int i : g[st]) {
        if (i == p) { continue; }
        depth[i] = depth[st] + 1;
        ans[1] += (ll)depth[i] - 1;
        dfs(i, st);
    }
    sz[st] = 1;
    len[st] = (ll)depth[st];
    for (int i : g[st]) {
        if (i == p) { continue; }
        sz[st] += sz[i];
        len[st] += len[i];
    }
}

void dfs2(int st, int p) {
    for (int i : g[st]) {
        if (i == p) { continue; }
        ans[i] = ans[st] + (ll)n - 2*(ll)sz[i];
        dfs2(i, st);
    }
}

void init() { FOR(j, 1, N) { F0R(i, MAX) { par[i][j] = par[par[i][j-1]][j-1]; } } }

int anc(int x, int y) {
	/* yth ancestor of x */
    for (int i=N-1; i>=0; i--) { if ((1<<i)<=y) { x = par[x][i]; y -= (1<<i); } }
    return x;
}

int lca(int x, int y) {
    if (depth[x] < depth[y]) { swap(x, y); }
    for (int i = N-1; i >= 0; i--) {
        if (depth[par[x][i]] >= depth[y]) { x = par[x][i]; }
    }
    if (x == y) { return x; }
    for (int i=N-1; i>=0; i--) {
        if (par[x][i] != par[y][i]) { x = par[x][i]; y = par[y][i]; }
    }
    return par[x][0];
}

int dist(int x, int y) {
    return depth[x] + depth[y] - 2 * depth[lca(x, y)];
}

int onebelow(int x, int y) {
    return anc(y, dist(y, lca(x, y))-1);
}

int dist2(int x, int y) {
    int node = onebelow(x, y);
    return ans[x] - len[node] + (depth[node]-1) * sz[node];
}

main() {
    cin >> n >> m;
    F0R(i, n-1) {
        int a, b; cin >> a >> b;
        g[a].pb(b); g[b].pb(a);
    }
    depth[1] = 1;
    dfs(1, -1);
    dfs2(1, -1);
    init();
    F0R(i, m) {
        int a, b; cin >> a >> b;
        if (depth[a] > depth[b]) { swap(a, b); }
        if (lca(a, b) != a) {
            ll choices = sz[a] * sz[b];
            ll sumb = len[b] - depth[b] * sz[b];
            ll suma = len[a] - depth[a] * sz[a];
            ll tot = sumb * sz[a] + suma * sz[b];
            double ans = dist(a, b) + (double) tot / (double) choices + 1;
            if (abs(ans-285.0873580) <= 0.00001) { cout << a << "|"<<b<<"|" << lca(a,b) << endl; }
            cout << fixed << setprecision(10) << ans << endl;
        }
        else {
            ll szbot = sz[b];
            int node = onebelow(a, b);
            ll sztop = n - sz[node];
            ll sumbot = len[b] - depth[b] * szbot;
            ll sumtop = dist2(a, b);
            ll choices = szbot * sztop;
            ll tot = sumbot * sztop + sumtop * szbot;
            double ans = dist(a, b) + 1 + (double) tot / (double) choices;
            if (abs(ans-285.0873580)<=0.00001) { cout << a << "|"<<b<<"|" << lca(a,b) << endl; }
            cout << fixed << setprecision(10) << ans << endl;

        }
    }
}