#include <iostream>

using namespace std;
const int max_N=1005;
int niz[max_N];
int nizPom[max_N];
int main()
{
    int N;
    cin>>N;
    int k;
    cin>>k;
    long long int zbir=0;
    for(int i=1;i<=N;i++){
        cin>>niz[i];

    }
    if(N%2==0){
         for(int i=1;i<=N/2;i++){

            for(int j=1;j<=i;j++){
                zbir+=j*niz[j];
                cout<<zbir<<" ";
                zbir+=j*niz[N+1-j];
                cout<<zbir<<" ";

            }
            for(int j=i+1;j<N+1-i;j++){
                zbir+=i*niz[j];
                cout<<zbir<<" ";

            }
        }
        zbir=zbir*2;

    }else{
        for(int i=1;i<=N/2;i++){

            for(int j=1;j<=i;j++){
                zbir+=j*niz[j];
                cout<<zbir<<" ";
                zbir+=j*niz[N+1-j];
                cout<<zbir<<" ";

            }
            for(int j=i+1;j<N+1-i;j++){
                zbir+=i*niz[j];
                cout<<zbir<<" ";

            }
        }
        zbir=zbir*2;
        for(int j=1;j<=N/2;j++){
                zbir+=j*niz[j];
                cout<<zbir<<" ";
                zbir+=j*niz[N+1-j];
                cout<<zbir<<" ";

            }
          zbir+=niz[N/2+1]*niz[N/2+1];

    }
   cout<<zbir;
    
    return 0;
}