#include <bits/stdc++.h>
using namespace std;
class library {
  static constexpr int max_number_of_books = 80;
  map<int, queue<int> > requests;
  int *requested_book, *available_book, available_books, cost, n, k;
  bitset<max_number_of_books> available;

 public:
  library() : available_books(0), cost(0) {
    scanf("%i%i", &n, &k), requested_book = new int[n],
                           available_book = new int[k];
    for (int book, i = 0; i < n; requested_book[i++] = book) {
      scanf("%i", &book);
      requests[--book].push(i);
    }
  }
  int thrown_book() {
    int book, thrown, latest_next_request = -1;
    for (int i = 0; i < k; i++) {
      book = available_book[i];
      if (requests[book].empty()) {
        thrown = i;
        break;
      } else {
        int next_request = requests[book].front();
        if (next_request > latest_next_request)
          thrown = i, latest_next_request = next_request;
      }
    }
    available.reset(available_book[thrown]);
    return thrown;
  }
  int solution() {
    for (int i = 0; i < n; i++) {
      int book = requested_book[i];
      requests[book].pop();
      if (available[book]) continue;
      if (available_books < k)
        available_book[available_books++] = book;
      else
        available_book[thrown_book()] = book;
      available.set(book);
      cost++;
    }
    return cost;
  }
};
int main() {
  library probem;
  printf("%i", probem.solution());
}
