Time limit
2s
Memory limit
128 MB
A power strip has N outlets, and the numbers of the electrical devices that will be used over the next K uses are given in order. To use a device, its plug must be inserted into the power strip. If an outlet is empty, a new plug can be inserted. If every outlet is occupied and the needed device is not plugged in, one currently plugged-in device must be unplugged. Given the entire usage order, find the minimum number of times a plug must be unplugged.
The first line contains the number of outlets N (1 ≤ N ≤ 100) and the total number of device uses K (1 ≤ K ≤ 100). The second line contains K natural numbers in usage order. Each number is a device identifier and is at most K. All integers in the input are separated by spaces.
Print the minimum number of times a plug must be unplugged.