#include<cstdio>
#include<queue>
using namespace std;
#define N 1001
int n,m,tot,d[N];
bool vis[N];
int main(){
scanf("%d%d",&m,&n);
for(int i=1;i<=n;i++) scanf("%d",&d[i]);
queue<int>q;
for(int i=1;i<=n;i++){
if(q.size()>m) vis[q.front()]=0,q.pop();
if(vis[d[i]]) continue;
q.push(d[i]);
vis[d[i]]=1;
tot++;
}
printf("%d\n",tot);
return 0;
}