#include <bits/stdc++.h>

#define MAX_PAGE 1010

using namespace std;

vector<int> pages;
unordered_set<int> cache;
vector<int> lastReference;

int getLeastRecentlyUsedPage() {
    int lruTime = INT_MAX, lruPage = -1;
    for (const int page : cache) {
        if (lastReference[page] < lruTime) {
            lruPage = page;
            lruTime = lastReference[page];
        }
    }
    return lruPage;
}

int main(){
    int k, v; cin >> k >> v;

    pages.resize(v);
    for (int i = 0; i < v; i++) {
        cin >> pages[i];
    }
    
    int misses = 0;
    lastReference.resize(MAX_PAGE, -1);
    for (int i = 0; i < v; i++) {
        if (!cache.count(pages[i])) {
            bool isCacheFull = cache.size() == k;
            if (isCacheFull) {
                cache.erase(getLeastRecentlyUsedPage());
            }
            misses++;
            cache.insert(pages[i]);
        }
        lastReference[pages[i]] = i;
    }

    cout << misses << endl;

    return 0;
}