#include <bits/stdc++.h>
using namespace std;
int m,ci,sm,h,t;
int p[1009];
int main()
{
cin>>m>>ci;
for(int i=0;i<ci;i++)
{
int x;
cin>>x;
bool oo=0;
for(int j=h;j<t;j++)
{
if(p[j]==x)
{
oo=1;
break;
}
}
if(oo)
{
sm++;
if(t-h==m)
{
h++;
}
p[t]=x;t++;
}
}
cout<<sm;
return 0;
}