#include <bits/stdc++.h>
using namespace std;
const int N = (int)2500000;
const long double eps = 1e-16, eps1 = 1e-10, OOO = 1e200,
                  PI = 3.14159265358979323;
const unsigned long long OOU = 1e19 * 1.7;
const long long OO = 1e18 * 8, mod = 1e6 + 3;
int main() {
  ios_base::sync_with_stdio(0);
  int n, k, a[100], h = 0, ans = 0, t, m, b[100], o;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    t = a[i];
    if (find(b, b + h, t) == b + h) {
      ans++;
      if (h < k)
        b[h++] = t;
      else {
        m = 0;
        o = -1;
        for (int j = 0; j < h; j++) {
          for (int y = i + 1; y <= n; y++)
            if (y < n && a[y] == b[j]) {
              if (y > o) m = j, o = y;
              break;
            } else if (y == n)
              m = j, o = 1e9;
        }
        b[m] = a[i];
      }
    }
  }
  cout << ans;
  return 0;
}
