#include <bits/stdc++.h>
using namespace std;
int stack[90], n, k, ans, bag, a[90], tim[90];
int vec[90][90], zoom[90];
bool vis[90];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    vec[a[i]][0]++;
    vec[a[i]][vec[a[i]][0]] = i;
  }
  for (int i = 1; i <= n; i++)
    tim[i] = vec[i][1], vec[i][vec[i][0] + 1] = n + 1, zoom[i] = 1;
  for (int i = 1; i <= n; i++) {
    if (!vis[a[i]]) {
      if (bag < k)
        bag++;
      else {
        int now, ref = 0;
        for (int i = 1; i <= n; i++)
          if (vis[i] && ref <= tim[i]) {
            now = i;
            ref = tim[i];
          }
        vis[now] = false;
      }
      ans++;
      zoom[a[i]]++;
      tim[a[i]] = vec[a[i]][zoom[a[i]]];
      vis[a[i]] = true;
    } else {
      zoom[a[i]]++;
      tim[a[i]] = vec[a[i]][zoom[a[i]]];
    }
  }
  printf("%d\n", ans);
}
