### main

loop do
  n, l = gets.split.map(&:to_i)
  break if (n | l) == 0
  
  ants = []
  n.times do
    di, pi = gets.strip.split
    ants << [(di == 'L') ? -1 : 1, pi.to_i]
  end
  #p ants

  t = 0
  rn = n
  last = nil
  
  loop do
    #p ants
    t += 1
    pos = Array.new(n){nil}
    exit_left = nil
    
    for i in (0...n)
      ai = ants[i]
      if ai
        ai[1] += ai[0]
        if ai[1] == 0 || ai[1] == l
          ants[i] = nil
          exit_left = i + 1 if ai[1] == 0
          rn -= 1
          if rn == 0
            last = exit_left || i + 1
            break
          end
          next
        end

        pi = pos[ai[1]]
        if pi
          ants[pi][0] *= -1
          ai[0] *= -1
        else
          pos[ai[1]] = i
        end
        
      end
    end
    break if rn == 0
  end

  puts [t, last].join(' ')
end