#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int main() {
    while (1) {
        int n, l;
        cin >> n >> l;
        if (n == 0) {
            break;
        }
        vector<pii> len[2];
        vector<bool> b[2];
        for (int i = 0; i < n; i++) {
            string dir;
            int dis;
            cin >> dir >> dis;
            if (dir == "R") {
                len[0].push_back(pii(dis, i + 1));
                b[0].push_back(true);
            } else {
                len[1].push_back(pii(dis, i + 1));
                b[1].push_back(true);
            }
        }
        for (int i = 0; i < 2; i++) {
            sort(len[i].begin(), len[i].end());
        }
        int time = 0;
        bool dir;
        int rlen = len[0].size();
        int llen = len[1].size();
        int rmax = (rlen > 0) ? l - len[0][0].first : -1;
        int lmax = (llen > 0) ? len[1][llen - 1].first : -1;
        int now;
        if (lmax >= rmax) {
            time = lmax;
            dir = false;
            b[1][llen - 1] = false;
            now = llen - 1;
        } else {
            time = rmax;
            dir = true;
            b[0][0] = false;
            now = 0;
        }
        while (1) {
            if (dir) {
                int pos = len[0][now].first;
                int num = -1;
                for (int i = 0; i < llen; i++) {
                    if (len[1][i].first <= pos) {
                        continue;
                    }
                    if (!b[1][i]) {
                        break;
                    }
                    if ((len[1][i].first - pos) % 2 == 0) {
                        num = i;
                    }
                }
                if (num == -1) {
                    break;
                } else {
                    now = num;
                    dir = !dir;
                    b[1][num] = false;
                }
            } else {
                int pos = len[1][now].first;
                int num = -1;
                bool ok = false;
                for (int i = 0; i < rlen; i++) {
                    if (!b[0][i]) {
                        num = i;
                        ok = false;
                        continue;
                    }
                    if (len[0][i].first >= pos) {
                        break;
                    }
                    if ((pos - len[0][i].first) % 2 == 0) {
                        num = i;
                        ok = true;
                        break;
                    }
                }
                if (!ok) {
                    break;
                } else {
                    now = num;
                    dir = !dir;
                    b[0][num] = false;
                }
            }
        }
        if (dir) {
            cout << time << " " << len[0][now].second << endl;
        } else {
            cout << time << " " << len[1][now].second << endl;
        }
    }
}



Measured memory_bytes: 3020