import scala.annotation.tailrec

object Main extends App {

  import scala.io.StdIn._
  import scala.math._

  val Array(n, q) = readLine.trim.split(' ').map(_.toInt)
  var orient: Int = 0
  for (_ ← 0 until q){
    readLine.trim.split(' ').map(_.toInt) match {
      case Array(0, k) ⇒ println((orient + k - 1) % n + 1)
      case Array(1, k) ⇒ orient = (orient + k) % n
    }
  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}
