#include <bits/stdc++.h>
using namespace std;
int n, m, q, x, y, f, z, maxi, mini, ansi, T, k, w, Q, tim;
int a[400005];
int nexti[400005];
set<int> s;
map<int, int> ma;
set<int>::iterator it, pos;
int main() {
  scanf("%d", &n);
  ;
  scanf("%d", &m);
  ;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ;
  }
  for (int i = n; i >= 1; i--) {
    if (ma[i] != 0) {
      nexti[i] = ma[a[i]];
    } else
      nexti[i] = 1000000007ll;
    ma[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (s.find(a[i]) == s.end()) {
      q++;
      if (s.size() != m) {
        s.insert(a[i]);
      } else {
        int cnt = 0;
        if (i == n) {
          break;
        }
        for (it = s.begin(); it != s.end(); it++) {
          int j = i + 1;
          for (; j <= n; j++) {
            if ((*it) == a[j]) {
              break;
            }
          }
          if (j > cnt) {
            cnt = j;
            pos = it;
          }
        }
        s.erase(pos);
        s.insert(a[i]);
      }
    }
  }
  cout << q << endl;
  return 0;
}
