#include <bits/stdc++.h>
using namespace std;
int n, k, ans;
vector<int> book[1005];
int number[1005], a[1005];
bool sub[1005];
struct node {
  int id, suf;
  node(int id = 0, int suf = 0) : id(id), suf(suf) {}
  bool operator<(const node b) const { return suf < b.suf; }
};
priority_queue<node> q;
int read() {
  char c = getchar();
  int x = 0;
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  return x;
}
void remove() {
  if (ans <= k) return;
  int maxi = 0;
  for (int i = 1; i <= 80; ++i)
    if (sub[i] && book[i][number[i]] > book[maxi][number[maxi]]) maxi = i;
  sub[maxi] = false;
}
int main() {
  n = read();
  k = read();
  for (int i = 1; i <= n; ++i) book[a[i] = read()].push_back(i);
  for (int i = 1; i <= 80; ++i) book[i].push_back(0x3f3f3f3f);
  book[0].push_back(0);
  for (int i = 1; i <= n; ++i) {
    if (!sub[a[i]]) {
      ++ans;
      remove();
      sub[a[i]] = true;
    }
    ++number[a[i]];
  }
  printf("%d\n", ans);
}
