#include <bits/stdc++.h>
using namespace std;
const int maxn = 82;
const int inf = 0x3f3f3f3f;
int n, m;
int vis[maxn];
int num[maxn];
int nxt[maxn];
int a[maxn];
int main() {
  while (~scanf("%d%d", &n, &m)) {
    memset(vis, 0, sizeof(vis));
    memset(num, 0, sizeof(num));
    memset(nxt, 0, sizeof(nxt));
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
      num[a[i]]++;
    }
    int ans = 0;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      num[a[i]]--;
      if (!vis[a[i]]) {
        ans++;
        if (cnt < m) {
          cnt++;
        } else {
          int index = 0;
          for (int k = 0; k < i; k++) {
            if (vis[a[k]]) {
              if (num[a[k]] == 0) {
                index = a[k];
                break;
              }
            }
          }
          if (index == 0) {
            memset(nxt, 0, sizeof(nxt));
            int mmax = -inf;
            for (int k = i + 1; k < n; k++) {
              if (vis[a[k]] && !nxt[a[k]]) {
                index = a[k];
                nxt[a[k]] = 1;
              }
            }
          }
          vis[index] = 0;
        }
        vis[a[i]] = 1;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
