#include <bits/stdc++.h>
using namespace std;
const int N = 81;
int n, k;
int a[N];
queue<int> needed[N];
bool in_bookstore[N];
int main() {
  int i, j;
  int ans = 0;
  int books = 0;
  int swaper;
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    needed[a[i]].push(i);
  }
  for (i = 1; i <= n; i++) {
    if (in_bookstore[a[i]]) {
      needed[a[i]].pop();
      continue;
    }
    if (books < k) {
      books++;
      ans++;
      in_bookstore[a[i]] = true;
      needed[a[i]].pop();
    } else {
      int maxx = -1;
      for (j = 1; j <= n; j++) {
        if (in_bookstore[j] && needed[j].empty()) {
          swaper = j;
          break;
        }
        if (in_bookstore[j] && needed[j].front() > maxx) {
          maxx = needed[j].front();
          swaper = j;
        }
      }
      in_bookstore[swaper] = false;
      in_bookstore[a[i]] = true;
      needed[a[i]].pop();
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
