#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000000 + 7;
const double eps = 1e-9;
queue<int> Q[100];
int ar[100];
bool isPresent[100];
int main() {
  int N, K;
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) {
    scanf("%d", &ar[i]);
    Q[ar[i]].push(i);
  }
  for (int i = 1; i <= N; i++) {
    Q[i].push(300);
  }
  int ans = 0;
  int curCap = 0;
  for (int i = 0; i < N; i++) {
    int x = ar[i];
    Q[x].pop();
    if (isPresent[x]) {
      continue;
    }
    ans++;
    if (curCap < K) {
      curCap++;
      isPresent[x] = true;
      continue;
    }
    int mx = 0;
    int mxval;
    for (int j = 1; j <= N; j++) {
      if (!isPresent[j]) {
        continue;
      }
      if (mx < Q[j].front()) {
        mx = Q[j].front();
        mxval = j;
      }
    }
    isPresent[mxval] = false;
    isPresent[x] = true;
  }
  cout << ans << endl;
  return 0;
}
