#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b)
    return a;
  else
    return b;
}
long long int min(long long int a, long long int b) {
  if (a < b)
    return a;
  else
    return b;
}
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
int XX[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int YY[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int n, i, j, x, k;
  cin >> n >> k;
  long long int arr[n];
  map<long long int, long long int> mpp;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    mpp[arr[i]]++;
  }
  set<long long int> s;
  long long int ans = 0;
  for (i = 0; i < n; i++) {
    long long int val = arr[i];
    if (s.find(val) != s.end()) {
      mpp[val]--;
      continue;
    }
    ans++;
    if (s.size() == k) {
      long long int maxi = INT_MAX, ind = -1, flag = 0;
      for (auto itr : s) {
        if (mpp[itr] == 0) {
          s.erase(itr);
          flag = 1;
          break;
        }
      }
      map<long long int, long long int> mpp2;
      if (flag == 0) {
        for (j = i + 1; j < n; j++) {
          if (s.find(arr[j]) != s.end()) {
            if (mpp2.count(arr[j]) == 0) {
              mpp2[arr[j]] = 1;
              ind = arr[j];
            }
          }
        }
        s.erase(ind);
      }
    }
    s.insert(val);
    mpp[val]--;
  }
  cout << ans;
}
