#include <bits/stdc++.h>
using namespace std;
const int N = 80 + 5;
int n, mx;
int now = 0;
bool active[N];
int v[N];
int res = 0;
int urm[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> mx;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  for (int i = 1; i <= n; i++) {
    int x = v[i];
    if (active[x]) continue;
    if (now == mx) {
      res++;
      for (int j = 1; j <= n; j++) urm[j] = (1 << 30);
      for (int j = n; j > i; j--) {
        urm[v[j]] = j;
      }
      int maurm = 0, who;
      for (int j = 1; j <= n; j++) {
        if (active[j]) {
          maurm = max(maurm, urm[j]);
          if (urm[j] == maurm) {
            who = j;
          }
        }
      }
      active[who] = 0;
      active[x] = 1;
    } else {
      now++;
      res++;
      active[x] = 1;
    }
  }
  cout << res << "\n";
  return 0;
}
