#include <iostream>
#include <queue>

using namespace std;
int main() {

    int m, n;
    cin >> m >> n;
    int missCount = 0;

    queue<int> cache;
    for(int i =0; i < n; i++) {
        int word;
        cin >> word;
        bool hit = false;

        //判断是否hit,对queue做遍历,注意保存queue
        queue<int> tmpQueue;
        int cacheSize = cache.size();
        for(int j = 0; j < cacheSize; j++) {
            int frontWord = cache.front();
            cache.pop();
            if(frontWord == word) hit = true;
            tmpQueue.push(frontWord);
        }
        cache = tmpQueue;

        //如果hit,跳过循环读下一个word
        if(hit) continue;

        //miss,missCount++,判断cache是否满
        missCount++;
        if(cache.size() >= m) {
            cache.pop();
        }
        cache.push(word);
    }
    cout << missCount << endl;
    return 0;
}