#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
T ext_gcd(T a, T b, T& first, T& second) {
  if (b == 0) {
    first = 1, second = 0;
    return a;
  }
  T d = ext_gcd(b, a % b, second, first);
  second -= first * (a / b);
  return d;
}
template <typename T>
T inverse(T a, T n) {
  T first, second;
  T t = ext_gcd(a, n, first, second);
  if (t != 1) return -1;
  return (first % n + n) % n;
}
template <typename T>
T Q_mul(T a, T b, T Mod) {
  T ret;
  for (ret = 0; b; b >>= 1, a = (a + a) % Mod)
    if (b & 1) ret = (ret + a) % Mod;
  return ret;
}
template <typename T>
T quick_pow_mod(T a, T b, T Mod) {
  T ret;
  for (ret = 1; b; b >>= 1, (a *= a) %= Mod)
    if (b & 1) (ret *= a) %= Mod;
  return ret;
}
template <typename T>
T quick_pow(T a, T b) {
  T ret;
  for (ret = 1; b; b >>= 1, a *= a)
    if (b & 1) ret *= a;
  return ret;
}
double combination(int n, int r) {
  if (r < n - r) return combination(n, n - r);
  double s = 1.0;
  for (int i = 1; i <= int(n - r); ++i) s *= (r + i), s /= i;
  return s;
}
template <typename T>
inline void read(T& v) {
  T ret = 0, sgnv = 1;
  char p;
  while (!isdigit(p = getchar()))
    if (p == '-') sgnv = -1;
  do ret = (ret << 3) + (ret << 1) + p - '0';
  while (isdigit(p = getchar()));
  v = sgnv * ret;
}
int in[80 + 5], pos[80 + 5], nxt[80 + 5], a[80 + 5];
int main() {
  int n, k, cost = 0, tot = 0;
  read(n), read(k);
  for (int i = 1; i <= int(n); ++i) read(a[i]), pos[i] = n + 1;
  for (int i = int(n); i > 0; --i) nxt[i] = pos[a[i]], pos[a[i]] = i;
  for (int i = 1; i <= int(n); ++i) {
    if (in[a[i]]) {
      in[a[i]] = i;
      continue;
    }
    ++cost;
    if (tot == k) {
      --tot;
      int maxi, id = -1;
      for (int i = 1; i <= int(n); ++i)
        if (in[i])
          if (id == -1 || maxi < nxt[in[i]]) id = i, maxi = nxt[in[i]];
      in[id] = 0;
    }
    ++tot, in[a[i]] = i;
  }
  printf("%d", cost);
  return 0;
}
