#include <bits/stdc++.h>

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(a) (int)(a.size())

#ifdef LOCAL
#define __lg(x) log2(x)
#endif

using ld = long double;
using ll = long long;

using namespace std;

void solve() {
    int T;
    cin >> T;
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    string s;
    cin >> s;

    vector<int> mv(n);
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'L') mv[i] = -1;
        else mv[i] = 1;
    }

    for (int i = 0; i < n; ++i) {
        if (a[i] % 2 != a[0] % 2) {
            cout << "NO\n";
            return;
        }
    }
    cout << "YES\n";

    vector<int> cord(n);
    for (int i = 0; i < n; ++i) {
        if (mv[i] == 1) cord[i] = a[i];
        else cord[i] = m + m - a[i];
    }
    sort(all(cord));
    int ans = 0;
    for (int i = 0; i < n - 1; ++i) {
        ans = max(ans, (cord[i + 1] - cord[i]));
    }
    ans = max(ans, cord[0] + 2 * m - 2 - cord.back());
    cout << (ans) / 2 + 1 << '\n';

}

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

    int t = 1;
    // cin >> t;
    while (t--) solve();
}