#include <bits/stdc++.h>

#define MAX_PAGE 1010

using namespace std;

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

int getLeastFrequentlyUsedPage() {
    int lfuCount = INT_MAX, lfuPage = -1;
    for (const int page : cache) {
        if (referencesCount[page] < lfuCount) {
            lfuPage = page;
            lfuCount = referencesCount[page];
        }
    }
    return lfuPage;
}

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

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

    cout << misses << endl;

    return 0;
}