#include <bits/stdc++.h>
using namespace std;
long long mx = -1e9, mn = 1e9;
long long T, n, m, k, a[200005], b, d, s, c[200005], x, y, ans, l, r, sum = 0;
long long one = 1;
vector<long long> v, v1;
map<long long, long long> use;
map<long long, long long> mp;
map<long long, long long>::iterator it;
map<long long, long long> mm;
map<long long, long long>::iterator itt;
queue<long long> q;
vector<pair<long long, long long>> vv;
int main() {
  scanf("%lld%lld", &n, &k);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    mp[a[i]]--;
    if (mm[a[i]] > 0) {
      continue;
    }
    ans++;
    mm[a[i]]++;
    if (sum < k) {
      sum++;
      continue;
    }
    int check = 0;
    for (itt = mm.begin(); itt != mm.end(); itt++) {
      if (mp[itt->first] == 0 && itt->second > 0 && itt->first != a[i]) {
        mm[itt->first]--;
        check++;
        break;
      }
    }
    if (check > 0) continue;
    use.clear();
    long long utga;
    for (int j = i + 1; j <= n; j++) {
      use[a[j]]++;
      if (use[a[j]] == 1 && mm[a[j]] == 1 && a[j] != a[i]) {
        utga = a[j];
      }
    }
    mm[utga]--;
  }
  cout << ans;
}
