/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, COBOL, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n,m;
scanf("%d %d",&n, &m);
int arr[n], query[m];
for(int i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(int t=0;t<m;t++)
{
scanf("%d",&query[t]);
}
int cost[m];
for(int i=0;i<m;i++)
{
cost[i]=0;
for(int t=0;t<n;t++)
{
cost[i]+= abs (query[i]-arr[t]);
}
printf("%d ",cost[i]);
}
}