#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  set<int> s;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    auto it1 = s.find(v[i]);
    if (it1 != s.end()) continue;
    for (auto it = s.begin(); it != s.end();) {
      bool f = true;
      int m = *it;
      for (int j = i; j < n; ++j) {
        if (v[j] == m) {
          f = false;
          break;
        }
      }
      if (f) {
        s.erase(it);
        it = s.begin();
      } else
        ++it;
    }
    if (s.size() < k) {
      s.insert(v[i]);
      res++;
      continue;
    }
    int z = 0;
    int b = 0;
    for (auto it = s.begin(); it != s.end(); ++it) {
      int m = *it;
      for (int j = i; j < n; ++j) {
        if (v[j] == m) {
          if (b < j) {
            b = j;
            z = m;
          }
          break;
        }
      }
    }
    s.erase(z);
    s.insert(v[i]);
    res++;
  }
  cout << res << endl;
  return 0;
}
