#include <bits/stdc++.h>
using namespace std;
const int N = 101;
int n, k;
int a[N];
int zl[N];
bool have[N];
int tot = 0, ans = 0;
int p[N], f;
void cl(int bh) {
  int i, j;
  memset(p, 0, sizeof(p));
  for (i = bh + 1; i <= n; i++) {
    if (p[a[i]] == 0 && have[a[i]] && a[i] != a[bh]) {
      p[0]++;
      p[a[i]] = 1;
      j = a[i];
    }
  }
  for (i = 1; i <= n; i++)
    if (p[i] == 0 && have[i] == 1 && i != a[bh]) {
      j = i;
      break;
    }
  have[j] = 0;
  return;
}
int main() {
  memset(have, 0, sizeof(have));
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    p[a[i]]++;
    if (p[a[i]] == 1) zl[0]++, zl[zl[0]] = a[i];
  }
  for (int i = 1; i <= n; i++) {
    if (have[a[i]] == 0 && tot < k) {
      ans++;
      tot++;
      have[a[i]] = 1;
    } else if (have[a[i]]) {
      continue;
    } else {
      have[a[i]] = 1;
      ans++;
      cl(i);
    }
  }
  printf("%d", ans);
  return 0;
}
