import scala.io.StdIn


object Main {
  def main(args: Array[String]): Unit = {
    while(true) {
      val num :: length :: _ = StdIn.readLine().split(" ").toList.map(_.toInt)
      if(num == 0) {
        return
      }

      l = length

      val ants = (1 to num) map { i =>
        val dir :: pos :: _ = StdIn.readLine().split(" ").toList
        (dir, pos.toInt)
      }
      println(solve(ants))
    }
  }
  var l: Int = 0

  def solve(ants: Seq[(String, Int)]): String = {
    val antsWithIndex = ants.zipWithIndex.map{ case ((di, po), id) => (di, po, id + 1) }
    val odds = antsWithIndex.filter(_._2 % 2 == 1)
    val evens = antsWithIndex.filter(_._2 % 2 == 0)

    val or = solve2(odds, 0)
    val er = solve2(evens, 0)

    if(or._1 == er._1) {
      val i = if(or._3 == "L") or._2 else er._2
      s"${or._1} ${i}"
    } else if(or._1 > er._1) {
      s"${or._1} ${or._2}"
    } else {
      s"${er._1} ${er._2}"
    }
  }

  def solve2(ants: Seq[(String, Int, Int)], carry: Int):(Int, Int, String) = {
    if(ants.size == 0) { (-1, -1, "R") }
    else if(ants.size == 1) {
      val a = ants.head
      if(a._1 == "R") {
        (l - a._2 + carry, a._3, "R")
      } else {
        (a._2 + carry, a._3, "L")
      }
    } else if(ants.size == 2) {
      val a1 = ants(0)
      val a2 = ants(1)

      (a1._1, a2._1) match {
        case ("L", "L") =>
          (a2._2 + carry, a2._3, "L")
        case ("R", "R") =>
          (l - a1._2 + carry, a1._3, "R")
        case ("R", "L") =>
          val suc = (a2._2 - a1._2) / 2
          solve2( Seq(("L", a1._2 + suc, a1._3), ("R", a2._2 - suc, a2._3)), carry + suc)
        case _ => // L R
          (a1._2, l - a2._2) match {
            case (x1, x2) if x1 == x2 => (carry + x1, a1._3, "L")
            case (x1, x2) if x1 < x2 => (carry + x2, a2._3, "R")
            case (x1, x2) if x1 > x2 => (carry + x1, a1._3, "L")
          }
      }
    }
    else {
      val collable = ants.sliding(2).flatMap{ s =>
        if(s(0)._1 == "R" && s(1)._1 == "L") {
          Some((s(1)._2 - s(0)._2) / 2)
        } else None
      }.toSeq
      if(collable.isEmpty) {
        val moved = ants.map{ case (di, po, in) =>
          val res = if(di == "R") { l - po } else po
          (res + carry, in, di)
        }
        val max = moved.map(_._1).max
        return moved.filter(_._1 == max).head
      }

      val coll = collable.min

      val suc = ants.flatMap{ case (di, po, in) =>
        val newpo = if(di == "R") { po + coll } else { po - coll }
        if(1 <= newpo && newpo <= l - 1) {
          Some((di, newpo, in))
        } else None
      }

      val flip = suc.map(_._2).groupBy(a => a).toList.filter(_._2.size > 1).map(_._1).toSet

      val next = suc.map {
        case x@(di, po, in) =>
          if(flip(po)) {
            val newdi = if(di == "R") "L" else "R"
            (newdi, po, in)
          } else x
      }

      solve2(next, carry + coll)
    }
  }
}