#include <bits/extc++.h>

using namespace std;
using namespace __gnu_pbds;

using ordered_set = tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>;


signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t;
    cin >> t;
    int n, m;
    cin >> n >> m;
    bool f1 = false, f2 = false;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] % 2 == 0) f1 = true;
        else f2 = true;
    }
    if (f1 and f2) {
        cout << "No";
        return 0;
    }
    cout << "Yes" << '\n';
    if (t == 1) return 0;
    string s;
    cin >> s;
    set<int> pos;
    vector<int> pos2;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            pos.insert(a[i] - 1);
        } else {
            if (a[i] > 1) pos.insert(m - 1 + m - a[i]);
            else pos.insert(0);
        }
    }
    for (auto x : pos) pos2.push_back(x);
    int res = 0;
    int cnt = pos.size();
    ordered_set del;
    for (int i = 0; i + 1 < pos2.size(); i++) {
        del.insert({pos2[i + 1] - pos2[i], i});
    }
    int ladel1 = 2 * (m - 1) - (pos2.back() - pos2[0]), ladel2 = pos2.size() - 1;
    del.insert({ladel1, ladel2});
    while (cnt > 1) {
        auto [x, i] = *del.begin();
        del.erase(del.begin());
        res += x / 2;
        if (ladel2 != -1 and i != ladel2) {
            del.erase({ladel1, ladel2});
            ladel1 -= 2 * x;
            del.insert({ladel1, ladel2});
        } else {
            ladel2 = -1;
        }
        cnt--;
    }
    cout << m - res << '\n';
    if (t == 2) return 0;
}