#include <bits/stdc++.h>
#define int long long

using namespace std;

int ans;

void go(vector <int> &arr, int n, int m, string s) {
    int maxx = 0;
    for (int x : arr) {
        maxx = max(maxx, x);
    }
    int c = 0;
    for (int x : arr) {
        c += (x == maxx);
    }
    if (c == n) {
        ans = max(ans, m);
        return;
    }
    for (int i = 0; i < m; ++i) {
        int maxx = 0;
        for (int j = 0; j < n; ++j) {
            if (arr[j] == m) {
                s[j] = 'L';
            } else if (arr[j] == 1) {
                s[j] = 'R';
            }
            maxx = max(arr[j], maxx);
        }
        if (maxx != m) go(arr, n, maxx, s);
        for (int j = 0; j < n; ++j) {
            if (s[j] == 'L') arr[j]--;
            else arr[j]++;
        }
    }
}

signed main() {
    int t, m;
    cin >> t;
    int n;
    cin >> n >> m;
    vector <int> arr(n);
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
        if (i != 0 && arr[i] % 2 != arr[i - 1] % 2) {
            cout << "No" << endl;
            return 0;
        }
    }
    string s;
    cin >> s;
    cout << "Yes" << endl;
    ans = 0;
    go(arr, n, m, s);
    if (t == 2) {
        cout << ans << endl;
    }
    return 0;
}
