#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Maxn = 1e5+10;
const int Inf = 0x7f7f7f7f;
const int Mod = 1e9+7;
int a[Maxn],v[Maxn];
int l_0[Maxn],r_1[Maxn];
double ans[Maxn];
int _1[Maxn],tol1,_0[Maxn],tol0;
int main(){
int n,l;
scanf("%d %d",&n,&l);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
for(int i=1;i<=n;i++)
scanf("%d",&v[i]);
for(int i=1;i<=n;i++)
if( v[i] == 1 )
r_1[i] = r_1[i-1] + 1,_1[++tol1] = a[i];
else r_1[i] = r_1[i-1];
for(int i=n;i>=1;i--)
if( v[i] == 0 )
l_0[i] = l_0[i+1] + 1,_0[++tol0] = a[i];
else l_0[i] = l_0[i+1];
for(int i=1;i<=n;i++)
{
double time,dis;
int dir;
if( v[i] == 1 )
{
if( l_0[i] >= r_1[i] )
{
int tmp = l_0[i] - r_1[i];
dir = 0;
dis = 1.0*(_1[1] + _0[tmp + 1])/2;
time= -1.0*(_1[1] - _0[tmp + 1])/2;
}
else
{
int tmp = r_1[i] - l_0[i];
dir = 1;
dis = 1.0*(_1[tmp] + _0[1])/2;
time= -1.0*(_1[tmp] - _0[1])/2;
}
}
else
{
if( r_1[i] >= l_0[i] )
{
int tmp = r_1[i] - l_0[i];
dir = 1;
dis = 1.0*(_1[tmp+1] + _0[1])/2;
time= -1.0*(_1[tmp+1] - _0[1])/2;
}
else
{
int tmp = l_0[i] - r_1[i];
dir = 0;
dis = 1.0*(_1[1] + _0[tmp])/2;
time= -1.0*(_1[1] - _0[tmp])/2;
}
}
// cout<<dir<<" "<<dis<<" "<<time<<endl;
if( dir == 0 ) ans[i] = time + dis;
else ans[i] = time + l-dis;
}
for(int i=1;i<=n;i++)
printf("%lld ",(ll)(ans[i]+0.5));
return 0;
}