#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
bool lol = false;
long int n,k;
cin >> n;
cin >> k;
long int t[n];
vector<long int> a;
long int ak = k;
long int tulos = 0;
for(int i = 0;i<n;i++)
{
cin >> t[i];
}
for(long int j = 0; j<n; j++)
{
for(long int x = j; x<n ;x++)
{
/*
for(long int y = 0;y<a.size();y++)
{
if(a[y]==t[x])
{
lol = true;
break;
}
}
if((lol = true)||ak>0)
{
if(lol = false);
{
a.push_back(t[x]);
ak--;
}
tulos++;
}
else
{
break;
}
*/
lol = (find(a.begin(), a.end(), t[x]) != a.end());
if(x == (n-1))
{
if((ak>0||lol == true))
{
tulos++;
}
break;
}
if(ak>0||lol == true))
{
tulos++;
if((find(lol == false)
{
a.push_back(t[x]);
ak--;
}
}
else
{
break;
}
}
a.clear();
ak = k;
}
cout << tulos;
return 0;
}