#include <bits/stdc++.h>
using namespace std;
int n, m, k, x, y, sum, cnt, ans, a[85], f[85][85];
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) f[n][i] = INT_MAX;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 1; j <= n; j++) {
      if (a[i] == j)
        f[i][j] = i;
      else
        f[i][j] = f[i + 1][j];
    }
  }
  set<int> s;
  for (int i = 0; i < n; i++) {
    if (s.count(a[i]) == 0) {
      if (s.size() == k) {
        int maxx = -1, maxi;
        for (int j = 1; j <= n; j++) {
          if (s.count(j) && f[i][j] > maxx) {
            maxx = f[i][j];
            maxi = j;
          }
        }
        s.erase(maxi);
        s.insert(a[i]);
        ans++;
      } else {
        s.insert(a[i]);
        ans++;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
