#include <bits/stdc++.h>
using namespace std;
int II() {
  int q;
  scanf("%d", &q);
  return q;
}
long long LII() {
  long long q;
  scanf("%lld", &q);
  return q;
}
int N, K;
int ar[2000];
int ff(set<int> &se, int jj) {
  int NN = se.size();
  int br[200];
  memset(br, 0, sizeof(br));
  for (auto it : se) br[it] = 1000000;
  for (auto it : se) {
    for (int i = jj + 1; i <= N; i++) {
      if (br[ar[i]] == 1000000) {
        br[ar[i]] = i;
      }
    }
  }
  vector<pair<int, int> > v;
  for (auto it : se) {
    v.push_back({br[it], it});
  }
  sort(v.rbegin(), v.rend());
  return v.front().second;
}
void solve() {
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    cin >> ar[i];
  }
  set<int> se;
  int ans = 0;
  for (int i = 1; i <= N; i++) {
    if (se.count(ar[i]) == 0) {
      if (se.size() < K) {
        se.insert(ar[i]);
        ans++;
      } else {
        int q = ff(se, i);
        ans++;
        se.erase(q);
        se.insert(ar[i]);
      }
    }
  }
  cout << ans << endl;
}
int32_t main() {
  int tt;
  tt = 1;
  int cas = 1;
  while (tt--) {
    solve();
  }
}
