let inpt = readLine()!.split(separator: " ").map{Int($0)!} let itemCount = inpt[0] let shuffCount = inpt[1] var cards = [Int]() for i in 1...itemCount { cards.append(i) } let shuffle = readLine()!.split(separator: " ").map{Int($0)! - 1} for sh in shuffle { let tmp = cards[sh] cards.remove(at: sh) cards.insert(tmp, at: 0) } print(cards.first!)