n, q = gets.chomp.split.map(&:to_i)
start = 0
q.times{
    a, b = gets.chomp.split.map(&:to_i)
    case a
    when 0
        x = (b + start) % n
        x = n if x == 0
        puts x
    when 1
        start = (b + start) % n
    end
}
