#include <bits/stdc++.h>

using ll = long long;
using ld = long double;
using namespace std;
mt19937 rnd(239);

void rek(int n, int m, int &otv, vector <int> a, vector <int> d) {
    for (int i = 0; i < n; i++) {
        if (a[i] == 1) d[i] = 1;
        if (a[i] == m) d[i] = -1;
    }
    for (int i = 0; i < n; i++) {
        a[i] += d[i];
        if (a[i] == 1) d[i] = 1;
        if (a[i] == m) d[i] = -1;
    }
    int ok = 1;
    for (int i = 0; i < n - 1; i++) {
        if (a[i] != a[i + 1] || d[i] != d[i + 1]) {
            ok = 0;
            break;
        }
    }
    if (ok) {
        otv = max(otv, m);
        return;
    }
    for (int it = 0; it < m; it++) {
        for (int i = 0; i < n; i++) {
            a[i] += d[i];
            if (a[i] == 1) d[i] = 1;
            if (a[i] == m) d[i] = -1;
        }
        ok = 1;
        for (int mm = m - 1; mm > 1; mm--) {
            for (int i = 0; i < n; i++) {
                if (a[i] == mm + 1) {
                    ok = 0;
                    break;
                }
            }
            if (!ok) break;
            rek(n, mm, otv, a, d);
        }
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);

    int t, n, m; cin >> t >> n >> m;
    vector <int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    string s; cin >> s;
    vector <int> srt = a;
    sort(srt.begin(), srt.end());
    for (int i = 0; i < n - 1; i++) {
        if (srt[i] + 1 == srt[i + 1]) {
            cout << "No\n";
            return 0;
        }
    }
    if (t == 1) {
        cout << "Yes\n";
        return 0;
    }

    vector <int> d(n);
    for (int i = 0; i < n; i++) d[i] = (s[i] == 'R' ? 1 : -1);
    int otv = 1;
    rek(n, m, otv, a, d);
    cout << "Yes\n" << otv << "\n";
    return 0;
}
