#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 3, mod = 998244353;
int a[N];
int n, m;
void slv1(){
    cin >> n >> m;
    for (int i = 0 ;i < n; i++){
        cin >> a[i];
        if (i % 2 == 0){
            if ((i + a[i]) % 2 != (a[0]) % 2){
                cout << "No";
                exit(0);
            }
        } else {
            if ((i + a[i]) % 2 == (a[0] % 2)){
                cout << "No";
                exit(0);
            }
        }
    }
    cout << "Yes\n";
}
int tp[N];
signed  main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    if (t >= 1){
        slv1();
    }
    string s;
    cin >> s;
    for (int i = 0 ;i < n; i++){
        if (s[i] == 'L'){
            tp[i] = -1;
        } else {
        tp[i] = 1;}
    }
    vector<pair<int, int>> rem;
    bool f = true;
    for (int i = 0; i < n; i++){
        if (a[i] != a[0]){
            f = false;
        }
    }
    if (f){
        rem.push_back({a[0], 0});
    }
    for (int k = 0 ;k < 3 * m; k++){
        for (int i = 0; i < n; i++){
            if (a[i] + tp[i] > m || a[i] + tp[i] < 1){
                tp[i] = -tp[i];
                a[i] += tp[i];
            } else {
                a[i] += tp[i];
            }
        }
        f = true;
        for (int i = 0 ;i < n; i++){
            if (a[i] != a[0]){
                f = false;
            }
        }
        if (f){
            rem.push_back({a[0], k + 1});
        }
    }
    sort(rem.begin(), rem.end());
    if (t >= 2){
        cout << rem.back().first << "\n";
    }
    if (t >= 3){
        if (rem.back().second == m){
            cout << 0;
        } else {
            cout << 1 << "\n";
            cout << rem.back().second << " " << rem.back().first << "\n";
        }
    }

}

