#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2200, MAX_K = 2200, INDEX = 1;
int n, k, a[MAX_N + INDEX], books[MAX_K + INDEX];
int ans = 0;
bool isBook(int x) {
  for (int i = 1; i <= k; i++) {
    if (books[i] == x) {
      return true;
    }
  }
  return false;
}
int dist(int book, int x) {
  for (int i = 1; x + i <= n; i++) {
    if (a[x + i] == book) {
      return i;
    }
  }
  return n + 1;
}
int getBest(int x) {
  int best = 1;
  for (int i = 2; i <= k; i++) {
    if (dist(books[i], x) > dist(books[best], x)) {
      best = i;
    }
  }
  return best;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    if (!isBook((a[i]))) {
      books[getBest(i)] = a[i];
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
