#include <bits/stdc++.h>

using namespace std;
#define int long long

void bad() {
    int type;
    cin >> type;
    int n, m;
    cin >> n >> m;
    vector <int> a(n);
    int c1 = 0, c2 = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        --a[i];
        if (a[i] & 1) {
            ++c1;
        } else {
            ++c2;
        }
    }
    string s;
    cin >> s;
    if (type >= 1) {
        if (c1 > 0 && c2 > 0) {
            cout << "No" << '\n';
            return;
        }
        cout << "Yes" << '\n';
    }
    if (type >= 2) {
        if (n == 2) {
            if (a[0] == a[1] && s[0] == s[1]) {
                cout << m << '\n';
            } else {
                if (m <= 2) {
                    cout << m << '\n';
                } else {
                    cout << 3 << '\n';
                }
            }
        } else if (n == 3) {
            bool flag = true;
            for (int i = 0; i < n; ++i) {
                if (s[i] != s[0] || a[i] != a[0]) {
                    flag = false;
                }
            }
            if (flag) {
                cout << m << '\n';
            } else {
                for (int i = 0; i < n; ++i) {
                    for (int j = 0; j < i; ++j) {
                        if (s[i] ==s[j] && a[j] == a[i]) {
                            flag = true;
                        }
                    }
                }
                if (flag) {
                    if (m <= 2) {
                        cout << m << '\n';
                    } else {
                        cout << 3 << '\n';
                    }
                } else {
                    cout << 2 << '\n';
                }
            }
        }
    }
}
signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    bad();
}
/*
2
2 3
1 3
RL
*/
