#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
template <class T, class U>
inline void Max(T &a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
inline void Min(T &a, U b) {
  if (a > b) a = b;
}
inline void add(int &a, int b) {
  a += b;
  while (a >= 1000000007) a -= 1000000007;
}
int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = ans * (long long)a % 1000000007;
    a = (long long)a * a % 1000000007;
    b >>= 1;
  }
  return ans;
}
int a[100], last[100], ne[100];
int main() {
  int T, i = 0, j, k, ca = 0, K, n, m;
  scanf("%d%d", &n, &K);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]), a[i]--;
  for (int i = n - 1; i >= 0; i--) last[i] = n;
  for (int j = n - 1; j >= 0; j--) {
    ne[j] = last[a[j]];
    last[a[j]] = j;
  }
  int ans = 0;
  set<int> s;
  for (int i = 0; i < n; i++) {
    if (s.count(i)) {
      s.erase(i);
      s.insert(ne[i]);
      continue;
    }
    if ((int)(s.size()) < K) {
      s.insert(ne[i]);
      ans++;
      continue;
    }
    s.erase(--s.end());
    s.insert(ne[i]);
    ans++;
  }
  printf("%d\n", ans);
  return 0;
}
