#include <bits/stdc++.h>
using namespace std;
const int NSIZ = 1010;
const int MSIZ = 1000010;
const int inf = 1010580540;
const int mxint = 2147483647;
const long long mxll = 9223372036854775807LL;
const long long prime15 = 1000000000000037LL;
const long long mod = 1000000007LL;
const long long mod9 = 1000000009LL;
int n, m, o, re = 0, test;
long long res = 0;
int a[NSIZ];
vector<int> ve;
char c[NSIZ];
bool chk[NSIZ];
int main() {
  int i, j, k, l;
  long long ll = 0, rr = mxll, mid;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < n; i++) {
    if (chk[a[i]]) continue;
    if (ve.size() < m) {
      ve.push_back(a[i]);
      chk[a[i]] = 1;
      re++;
      continue;
    }
    pair<int, int> mx = pair<int, int>(0, 0);
    for (j = 0; j < ve.size(); j++) {
      int nx = n;
      for (k = i + 1; k < n; k++) {
        if (a[k] == ve[j]) {
          nx = k;
          break;
        }
      }
      mx = max(mx, pair<int, int>(nx, j));
    }
    chk[ve[mx.second]] = 0;
    ve.erase(ve.begin() + mx.second);
    re++;
    ve.push_back(a[i]);
    chk[a[i]] = 1;
  }
  printf("%d", re);
  return 0;
}
