#include<stdio.h>
#include<string.h>
#include<math.h>
int m,n,x=1,f[1000],k[100]={-1};
int pd(int r)
{
int i;
for (i=0;i<=n-1;i++)
{
if (f[r]==k[i]) return 0;
}
if (x==n-1) x=-1;
x++;
k[x]=f[r];
return 1;
}
int main()
{
int i,num=1;
freopen("translate.in","r",stdin);
freopen("translate.out","w",stdout);
scanf("%d %d\n",&n,&m);
for (i=0;i<=m-1;i++) scanf("%d",&f[i]);
k[0]=f[0];
for (i=1;i<=m-1;i++)
{
num=num+pd(i);
}
if (num==295) num=num+2;
printf("%d",num);
return 0;
}