#include <bits/stdc++.h>

using namespace std;

#define int long long
#define pb push_back
#define ff first
#define ss second

int n, m;
int ans = 0;

bool check(vector<int> &a) {
    for (int i = 0; i < n - 1; i++) {
        if (abs(a[i] - a[i + 1]) % 2 == 1) return false;
    }
    return true;
}

map<pair<int, pair<vector<int>, vector<int>>>, bool> mp;

void gen(vector<int> &a, vector<int> &ty, int sz) {
    if (mp[{sz, {a, ty}}] == true) return;
    mp[{sz, {a, ty}}] = true;
    for (int i = 0; i < a.size(); i++) {
        if (a[i] == 1 && ty[i] == 0) ty[i] = 1;
        if (a[i] == sz && ty[i] == 1) ty[i] = 0;
    }
    bool f = true;
    for (int i = 0; i < a.size(); i++) {
        if (a[i] != a[0]) f = false;
        if (ty[i] != ty[0]) f = false;
    }
    if (f) {
        ans = max(ans, sz);
        return;
    }
    int mx = 0;
    for (int i = 0; i < n; i++) {
        mx = max(mx, a[i]);
    }
    for (int i = 0; i < n; i++) {
        if (ty[i] == 0) a[i]--;
        if (ty[i] == 1) a[i]++;
    }
    for (int i = mx; i < sz; i++) {
        gen(a, ty, i);
    }
    gen(a, ty, sz);
}

void solve() {
    int t;
    cin >> t;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    string s;
    cin >> s;
    if (t == 1) {
        if (check(a)) cout << "Yes";
        else cout << "No";
        return;
    }
    vector<int> ty;
    for (auto i: s) {
        if (i == 'L') ty.push_back(0);
        else ty.push_back(1);
    }
    if (!check(a)) {
        cout << "No";
        return;
    }
    cout << "Yes" << "\n";
    ans = 1;
    gen(a, ty, m);
    cout << ans;
}

signed main() {
//    freopen("input.txt", "rb", stdin);
//    freopen("output.txt", "wb", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
//    cin >> t;
    while (t--) solve();
}
