#include <bits/stdc++.h>
using namespace std;
int n, k, p, ans;
int a[500010];
queue<int>q[100010];
int nex[500010];
bool vis[100010];
struct cmp {
bool operator()(const int &x, const int &y) {
return nex[x] < nex[y];
}
};
priority_queue<int, vector<int>, cmp> Q;
int main() {
cin >> n >> k >> p;
for (int i = 1; i <= p; i++) {
cin >> a[i];
q[a[i]].push(i);
}
for (int i = 1; i <= p; i++) {
q[a[i]].pop();
if (q[a[i]].empty())
nex[i] = p + 1;
else
nex[i] = q[a[i]].front();
}
for (int i = 1; i <= p; i++) {
if (!vis[a[i]]) {
if (Q.size() == k) {
vis[Q.top()] = 0;
Q.pop();
}
Q.push(i);
ans++;
vis[a[i]] = 1;
} else {
k++;
Q.push(i);
}
}
cout << ans;
}