#include <bits/stdc++.h>
using namespace std;
int dx[] = {+1, -1, 0, 0};
int dy[] = {0, 0, +1, -1};
int dx2[] = {+1, -1, 0, 0, +1, +1, -1, -1};
int dy2[] = {0, 0, +1, -1, +1, -1, -1, +1};
inline long long squ(long long x) { return (x * x); }
inline long long power(long long bs, long long k) {
  long long x = 1LL, y = bs;
  if (k == 0) return 1LL;
  while (k > 0) {
    if (k % 2) x *= y;
    y *= y;
    k /= 2;
  }
  return x;
}
bool bt[110];
int a[110], n, k, nxt[110][110];
int farthest(int u) {
  int i, j, mx = 0, ps = 0;
  for (i = 1; i <= n; i++) {
    if (bt[i]) {
      if (mx < nxt[u][i]) mx = nxt[u][i], ps = i;
    }
  }
  return ps;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.unsetf(ios::floatfield);
  cout.precision(6);
  cout.setf(ios::fixed, ios::floatfield);
  ;
  cin >> n >> k;
  int i, j;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    fill(nxt[i], nxt[i] + 110, n);
    for (j = n - 1; j >= i; j--) {
      nxt[i][a[j]] = j;
    }
  }
  int tk = 0, ans = 0;
  memset(bt, false, sizeof(bt));
  for (i = 0; i < n; i++) {
    if (!bt[a[i]]) {
      ans++;
      tk++;
      if (tk > k) {
        j = farthest(i);
        bt[j] = false;
        tk = k;
      }
      bt[a[i]] = true;
    }
  }
  cout << ans;
  return 0;
}
