#include <cassert>
#include <iostream>
#include <numeric>
#include <sstream>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

int main()
{
    constexpr int EMPTY = -99;
    while (true) {
        int n, l;
        cin >> n >> l;
        if (n == 0 && l == 0) {
            break;
        }
        vector<pair<int, int>> v(l + 1, make_pair(EMPTY, EMPTY));
        for (int i = 0; i < n; ++i) {
            char c;
            int p;
            cin >> c >> p;
            if (c == 'L') {
                v[p].first = i;
            }
            else {
                v[p].second = i;
            }
        }

        auto move_ = [EMPTY, l](const vector<pair<int, int>>& v) {
            vector<pair<int, int>> r(v.size(), make_pair(EMPTY, EMPTY));
            for (int i = 0; i < v.size(); ++i) {
                // cout << "r[" << (i - 1) << "] = (" << v[i].first << ", "
                //     << r[i - 1].second << ")" << endl;
                // cout << "r[" << (i + 1) << "] = (" << v[i + 1].first << ", "
                //     << v[i].second << ")" << endl;
                if (i > 0) {
                    r[i - 1] = make_pair(v[i].first, r[i - 1].second);
                }
                if (i < l) {
                    r[i + 1] = make_pair(r[i + 1].first, v[i].second);
                }
                // if (v[i].first != EMPTY) {
                //    assert(i - 1 >= 0);
                //}
                // if (v[i].second != EMPTY) {
                //    assert(i +1 < r.size());
                //}
            }
            for (auto&& i : r) {
                if (i.first != EMPTY && i.second != EMPTY) {
                    swap(i.first, i.second);
                }
            }

            return r;
        };

        int count = 0;
        while (true) {
            auto p = [](int x) {
                stringstream ss;
                ss << x;
                return x == EMPTY ? " " : ss.str();
            };
            // cout << count << " ";
            // for (auto&& i : v) {
            //    cout << "(" << p(i.first) << ", " << p(i.second) << ")";
            //}
            // cout << endl;
            vector<pair<int, int>> result;
            result = move_(v);
            int left = result[0].first;
            int right = result[l].second;
            // cout << "to ";
            // for (auto&& i : result) {
            //    cout << "(" << p(i.first) << ", " << p(i.second) << ")";
            //}
            // cout << endl;
            count += 1;
            result[0] = result[l] = make_pair(EMPTY, EMPTY);
            // cout << "to ";
            // for (auto&& i : result) {
            //    cout << "(" << p(i.first) << ", " << p(i.second) << ")";
            //}
            // cout << endl;
            bool end_ = accumulate(begin(result), end(result), true,
                                   [](bool b, const pair<int, int>& a) {
                                       return b && a.first == EMPTY &&
                                              a.second == EMPTY;
                                   });
            // cout << "exit " << end_ << endl;
            if (end_) {
                if (l == EMPTY) {
                    cout << count + 1 << " "
                         << (left == EMPTY ? right + 1 : left + 1) << endl;
                }
                else {
                    cout << count << " "
                         << (left == EMPTY ? right + 1 : left + 1) << endl;
                }
                break;
            }
            v = result;
        }
    }
}


Measured memory_bytes: 3088