#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int t[2 * N];
map<int, int> mp, vis, nex;
struct cmp {
  int num;
  int nex;
  bool operator<(const cmp &a) const {
    if (nex == a.nex) return num < a.num;
    return nex > a.nex;
  }
} tmp;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t[i]);
  }
  mp.clear();
  nex.clear();
  vis.clear();
  for (int i = n; i >= 1; i--) {
    if (mp[t[i]])
      nex[i] = mp[t[i]];
    else
      nex[i] = 0x3f3f3f3f;
    mp[t[i]] = i;
  }
  set<cmp> s;
  set<int> ss;
  set<cmp>::iterator it;
  int p;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    tmp.num = t[i];
    tmp.nex = i;
    it = s.find(tmp);
    if (it != s.end()) {
      s.erase(it);
      tmp.num = t[i];
      tmp.nex = nex[i];
      s.insert(tmp);
    } else {
      tmp.num = t[i];
      tmp.nex = nex[i];
      if (s.size() + 1 > m) s.erase(s.begin());
      s.insert(tmp);
      ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
