#include <bits/stdc++.h>
using namespace std;
int MOD = 1e9 + 7;
long long INF = 1e18;
int n, k, a[85];
int inq[85] = {};
vector<int> times[85];
set<pair<int, int> > pq;
int solve() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i], times[a[i]].push_back(i);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (inq[a[i]]) {
      pq.erase({i, a[i]});
      auto nxt = upper_bound(times[a[i]].begin(), times[a[i]].end(), i);
      if (nxt != times[a[i]].end()) pq.insert({*nxt, a[i]});
    } else {
      if (pq.size() >= k) {
        int x = (--pq.end())->second;
        inq[x] = 0;
        pq.erase(--pq.end());
      }
      auto nxt = upper_bound(times[a[i]].begin(), times[a[i]].end(), i);
      if (nxt != times[a[i]].end()) pq.insert({*nxt, a[i]});
      inq[a[i]] = 1;
      sum++;
    }
  }
  cout << sum << endl;
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  solve();
  return 0;
}
