// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(x) x.begin(), x.end()

// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    int n, m, cur_rem;
    cin >> n >> m;
    vector<int> a(n);
    cur_rem = -1;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (cur_rem == -1) {
            cur_rem = a[i] % 2;
        } else {
            if (cur_rem != a[i] % 2) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    string dir;
    cin >> dir;
    cout << "Yes" << endl;
    vector<int> time_inters = {};
    for (int i = 0; i < n; i++) {
        a[i]--;
        if (dir[i] == 'R') {
            time_inters.push_back((m - 1 - a[i]));
        } else {
            if (a[i] == m - 1) {
                time_inters.push_back(0);
            } else {
                time_inters.push_back(a[i] + m - 1);
            }
        }
    }
    sort(all(time_inters));
    int ans = 0;
    int max_ans = 0;
    for (int i = 1; i < n; i++) {
        ans += (time_inters[i] - time_inters[i - 1]) / 2;
        max_ans = max(max_ans, (time_inters - time_inters[i - 1]) / 2);
//        cout << time_inters[i] << " ";
    }
//    cout << endl;
    ans += (time_inters[0] - time_inters[n - 1] + 2 * m - 2) / 2;
    max_ans = max(max_ans, (time_inters[0] - time_inters[n - 1] + 2 * m - 2) / 2);
    cout << m - ans + max_ans << endl;
    return 0;
}
