# include <iostream>
using namespace std;

const int INF=1e9;
const int MAX=2e5+11;

int T;
int n,m;
int a[MAX];
char dir[MAX];

pair<int,pair<long long,int>> ans={0,{-1,-1}};

void simulate(int one, int two, long long t, int p, bool spec=0)
{
    if(p>10) return ;

    if(dir[one]==dir[two])
    {
        if(dir[one]=='L')
        {
            int cnt=min(a[one],a[two])-1;
            t+=cnt;
            a[one]-=cnt;
            a[two]-=cnt;
            if(a[one]<a[two]) dir[one]='R';
            else dir[two]='R';
        }
        else
        {
            int cnt=m-max(a[one],a[two]);
            t+=cnt;
            a[one]+=cnt;
            a[two]+=cnt;
            if(a[one]>a[two]) dir[one]='L';
            else dir[two]='L';
        }
        simulate(one,two,t,p+1);
    }
    else
    {
        if(!spec and ((a[one]<=a[two] and dir[one]=='R') or (a[one]>=a[two] and dir[one]=='L')))
        {
            int d=abs(a[one]-a[two]);
            int mp=(a[one]+a[two])/2;
            int cnt=d/2;
            t+=cnt;
            ans=max(ans,{mp,{t,mp}});
            a[one]=mp;
            a[two]=mp;
            simulate(one,two,t,p+1,1);
        }
        else
        {
            int d1=0;
            if(dir[one]=='L') d1=a[one]-1;
            else d1=m-a[one];

            int d2=0;
            if(dir[two]=='L') d2=a[two]-1;
            else d2=m-a[two];

            int d=min(d1,d2);
            t+=d;
            if(dir[one]=='L') a[one]-=d;
            else a[one]+=d;
            if(dir[two]=='L') a[two]-=d;
            else a[two]+=d;

            if(d==d1)
            {
                if(dir[one]=='L') dir[one]='R';
                else dir[one]='L';
            }
            if(d==d2)
            {
                if(dir[two]=='L') dir[two]='R';
                else dir[two]='L';
            }

            simulate(one,two,t,p+1);
        }
    }
}

int calc(int one, int two)
{
    pair<int,char> ori1={a[one],dir[one]},ori2={a[two],dir[two]};
    ans={0,{-1,-1}};
    if(a[one]==a[two] and dir[one]==dir[two]) return m;
    else
    {
        simulate(one,two,0,0);
        a[one]=ori1.first;dir[one]=ori1.second;
        a[two]=ori2.first;dir[two]=ori2.second;
        return ans.first;
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    cin>>T;
    cin>>n>>m;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) cin>>dir[i];

    bool f[2]={0,0};
    for(int i=1;i<=n;i++) f[a[i]%2]=1;
    if(f[0] and f[1]) {cout<<"No"<<"\n";return 0;}
    cout<<"Yes"<<"\n";
    if(T==1) return 0;

    int ans=m;
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++) ans=min(ans,calc(i,j));
    }

    cout<<ans<<"\n";
    if(T==2) return 0;

    return 0;
}

