/* GCC */
#define author FIvanO
#include <iostream>
#include <fstream>
#include <algorithm>
#include <math.h>
#include <string>
#include <map>
#include <vector>
const int Max=100000;

using namespace std;

int a[Max+10];
int b[Max+10];
int VVP[Max+10];
int main()
{
ios_base::sync_with_stdio(0);
freopen("pelmeni.in","r",stdin);
freopen("pelmeni.out","w",stdout);
int n,m;
cin>>n>>m;
for (int i=0; i<n; i++) { cin>>a[i]; VVP[i]=0; }
for (int i=0; i<m; i++) cin>>b[i];

for (int i=0; i<m; i++)
{
    int *up=upper_bound(a,a+n,b[i]);
//    cout<<"b[i]= "<<b[i]<<" i= "<<i<<" up= "<<(up-a)<<endl;
    for (int k=0; k<(up-a); k++) { VVP[i]+=a[k]; }// cout<<"VVP[i]= "<<VVP[i]<<" a[i]= "<<a[i]<<endl; }
    for (int k=(up-a); k<n; k++) { VVP[i]+=b[i]; }
    //cout<<"VVP[i]= "<<VVP[i]<<" b[i]= "<<b[i]<<endl; }
    //cout<<"VVP[i]= "<<VVP[i]<<" "<<endl;
}
for (int i=0; i<m-1; i++) cout<<VVP[i]<<" ";
cout<<VVP[m-1]<<endl;
return 0;
}
