#include <bits/stdc++.h>
using namespace std;
int N, K, arr[80], nxt[80];
int main() {
  if (fopen("data.in", "r")) freopen("data.in", "r", stdin);
  scanf("%d", &N);
  scanf("%d", &K);
  for (int i = 0; i < N; i++) {
    scanf("%d", &arr[i]);
    nxt[i] = ((1 << 29) + 123);
    for (int j = i - 1; j >= 0; j--) {
      if (arr[j] == arr[i]) {
        nxt[j] = i;
        break;
      }
    }
  }
  set<int> cur;
  int cost = 0;
  set<pair<int, int> > del;
  for (int i = 0; i < N; i++) {
    if (!cur.size() || cur.find(arr[i]) == cur.end()) {
      if (cur.size() == K) {
        int id = del.rbegin()->second;
        del.erase(--del.end());
        cur.erase(id);
      }
      del.insert(make_pair(nxt[i], arr[i]));
      cur.insert(arr[i]);
      cost++;
    } else if (cur.find(arr[i]) != cur.end()) {
      del.erase(make_pair(i, arr[i]));
      if (nxt[i] == ((1 << 29) + 123))
        cur.erase(arr[i]);
      else
        del.insert(make_pair(nxt[i], arr[i]));
    }
  }
  printf("%d\n", cost);
  return 0;
}
