#include <bits/stdc++.h>
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
using namespace std;
const long long MOD = 1e18;
long long n, m;
long long a[200005], st, k;
long long f[200005][2], dp[200005][2], dd[200005], gt[200005], c[200005],
    r[200005];
string s[200005];
void act() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long cnt = 0;
  set<int> p, t;
  for (int i = 1; i <= n; i++) {
    long long x = a[i];
    if (p.find(x) == p.end()) cnt++, p.insert(x);
    if (p.size() > k) {
      t = p;
      t.erase(x);
      for (int j = i + 1; j <= n; j++) {
        if (t.size() == 1) break;
        t.erase(a[j]);
      }
      p.erase(*(t.begin()));
    }
  }
  cout << cnt;
}
int main() {
  int t = 1;
  while (t--) act();
}
