#include <bits/stdc++.h>
using namespace std;
int data[100];
int store[100];
int main() {
  int n, k;
  while (scanf("%d%d", &n, &k) != EOF) {
    bool vis[100] = {0};
    for (int i = 0; i < n; i++) scanf("%d", &data[i]);
    int cur = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      int num = data[i];
      if (vis[num]) continue;
      if (cur < k) {
        store[cur++] = num;
        vis[num] = 1;
      } else if (cur == k) {
        int index = -1;
        int pos;
        for (int j = 0; j < cur; j++) {
          int l;
          for (l = i; l < n; l++)
            if (data[l] == store[j]) break;
          if (l == n) {
            pos = j;
            break;
          }
          if (l > index) {
            index = l;
            pos = j;
          }
        }
        vis[store[pos]] = 0;
        for (int j = pos; j < cur - 1; j++) store[j] = store[j + 1];
        cur--;
        store[cur++] = num;
        vis[num] = 1;
      }
      ans++;
    }
    printf("%d\n", ans);
  }
  return 0;
}
