#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N = 1e3 + 10;
int mem[N],n,m,a[N],hh = 0,tt = -1,cnt;
int main()
{
scanf("%d %d",&m,&n);
for (int i = 1;i<=n;i++)scanf("%d", &a[i]);
for (int i = 1;i<=n;i++)
{
bool t = false;
for (int j = hh; j <= tt; j++)
{
if (a[i] == mem[j])
{
t = true;
}
}
if (tt - hh + 1<=m-1)
{
t == true ? cnt += 0: cnt++;
mem[++tt] = a[i];
}
else
{
hh++;
t == true ? cnt += 0: cnt++;
mem[++tt] = a[i];
}
}
printf("%d",cnt);
return 0;
}