#include <bits/stdc++.h>
using namespace std;
const int maxn = 100;
vector<int> vec[maxn];
int N, K, have[maxn], a[maxn], len[maxn];
void do_it(int x) {
  int T, X, i;
  T = -1;
  for (i = 0; i < maxn; i++) {
    if (have[i] == 1 && vec[i].size() == len[i] && len[i] != 0) {
      T = 1000;
      X = i;
      continue;
    }
    if (have[i] == 1) {
      if (vec[i][len[i]] > T) {
        T = vec[i][len[i]];
        X = i;
      }
    }
  }
  have[X] = 0;
  have[x] = 1;
}
int main(void) {
  int i, j, n, m, ans;
  scanf("%d %d", &n, &K);
  for (i = 0; i < n; i++) {
    vec[i].clear();
    len[i] = 0;
  }
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    vec[a[i]].push_back(i);
  }
  N = 0;
  ans = 0;
  for (i = 0; i < n; i++) {
    if (have[a[i]] == 0) {
      ans++;
      if (N < K) {
        have[a[i]] = 1;
        N++;
      } else {
        do_it(a[i]);
      }
    }
    len[a[i]]++;
  }
  cout << ans << endl;
}
