#include <bits/stdc++.h>
using namespace std;
int A[85], nxt[85], B[85];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k, i, res = 0;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> A[i];
  for (i = 1; i <= n; i++) B[i] = INT_MAX;
  for (i = n - 1; i >= 0; i--) {
    nxt[i] = B[A[i]];
    B[A[i]] = i;
  }
  set<pair<int, int>, greater<pair<int, int>>> s;
  for (i = 0; i < n; i++) {
    if ((int)s.size() < k) {
      if (s.find({i, A[i]}) == s.end()) res++;
      s.erase({i, A[i]});
    } else {
      if (s.find({i, A[i]}) == s.end()) {
        res++;
        s.erase(s.begin());
      } else
        s.erase({i, A[i]});
    }
    s.insert({nxt[i], A[i]});
  }
  cout << res;
  return 0;
}
