1. 빈칸이 있으면 꽃는다.
2. 이미 사용중인 플러그의 요청이면 스킵한다.
3. 1,2에도 뽑아야 한다면 현재에서 가장 나중에 쓰이는 플러그를 뽑는다.
let p = readLine()!.split(separator: " ").map{Int(String($0))!}
let (n,k) = (p[0],p[1])
var plugs = readLine()!.split(separator: " ").map{Int(String($0))!}
var inserted = [Int]()
var result = 0
for i in 0..<k {
if inserted.contains(plugs[i]) {
continue
}
else if inserted.count < n {
inserted.append(plugs[i])
}
else {
var farthest = 0
var index = 0
for j in 0..<inserted.count {
if let temp = plugs[i...].firstIndex(of: inserted[j]) {
if farthest < temp {
farthest = temp
index = j
}
}else {
index = j
break
}
}
inserted[index] = plugs[i]
result += 1
}
}
print(result)