while true do
  n, l = gets.split(' ').map(&:to_i)
  break if n == 0 && l == 0
  array = (1..n).to_a.map do |i|
    d_s, p_s = gets.split(' ')
    p = p_s.to_i
    t, d = (d_s == 'R') ? [l-p, 1] : [p, -1]
    {d: d, t: t, i: i, p: p}
  end
  t_max = array.map{|e| e[:t]}.max
  d_ans = array.select{|e| e[:t] == t_max}.map{|e| e[:d]}.inject(1, :*)
  array_ans = array.each_with_index.map do |e, index|
    left_count = array[0..index].select{|el| el[:d] == 1 && (el[:p]-e[:p]).even?}.count
    right_count = array[index..-1].select{|el| el[:d] == -1  && (el[:p]-e[:p]).even?}.count
    e.merge({d_exit: (left_count - right_count) * 2 -e[:d]})
  end.select{|e| e[:d_exit]*d_ans>0}.select{|e| d_ans==-1 ? (e[:p]+t_max).even? : (e[:p]+l+t_max).even? }
  i_ans = d_ans == 1 ? array_ans[0][:i] : array_ans[-1][:i]
  puts "#{t_max} #{i_ans}"
end