class Ant
	def initialize(*args)
		@index, @dx, @x = args
	end
	attr_accessor :index, :dx, :x, :time
end

loop {
	n, l = gets.split.map &:to_i
	break if n == 0
	ants = (1..n).map {|i|
		dir, x = gets.chomp.split 
		Ant.new(i, {?R=>1, ?L=>-1}[dir], x.to_i)
	}

	events = []
	ants.combination(2){|a1, a2|
		next if a1.dx == a2.dx
		next if (a1.x + a2.x).odd?
		if a1.dx == 1
			next if a1.x > a2.x
			events << [a1.index, a2.index, (a2.x - a1.x) / 2]
		else
			next if a1.x < a2.x
			events << [a1.index, a2.index, (a1.x - a2.x) / 2]
		end
	}
	ants.each{|a|
		a.time = (a.dx > 0 ? l - a.x : a.x)
	}

	events.sort_by!(&:last)
	
	events.each{|i, j, _|
		a1 = ants[i-1]
		a2 = ants[j-1]
		a1.index, a2.index = a2.index, a1.index
	}

	max_t = ants.map(&:time).max
	last = ants.select{|a| a.time == max_t}
	if last.size == 1
		last = last[0].index
	else
		last = last.find{|a| a.dx == -1}.index
	end
	puts "#{max_t} #{last}"
}