#include <bits/stdc++.h>
using namespace std;
void fun() {
  int n, capacity;
  cin >> n >> capacity;
  int count = 0;
  int num[n];
  int lib[capacity], j = 0;
  for (int i = 0; i < n; i++) {
    cin >> num[i];
  }
  for (int i = 0; i < n; i++) {
    int found = 0;
    if (i == 0) {
      lib[j] = num[i];
      count++;
      j++;
    } else {
      for (int k = 0; k < j; k++) {
        if (lib[k] == num[i]) {
          found = 1;
          break;
        }
      }
      if (found == 0) {
        if (j != capacity) {
          lib[j] = num[i];
          j++;
          count++;
        } else {
          int min = j - 1, flag, min2 = n - 1, min3 = j - 1, prevmin = -1,
              min4 = j - 1;
          int counter = 0;
          for (int x = 0; x < j; x++) {
            flag = 0;
            for (int y = i; y < n; y++) {
              if (num[y] == lib[x]) {
                min2 = y;
                min3 = x;
                flag = 1;
                counter++;
                break;
              }
            }
            if (flag == 0) {
              min = x;
            } else {
              if (prevmin < min2) {
                prevmin = min2;
                min4 = x;
              }
            }
          }
          if (counter == j) {
            lib[min4] = num[i];
          } else {
            lib[min] = num[i];
          }
          count++;
        }
      }
    }
  }
  cout << count << endl;
}
int main() {
  fun();
  return 0;
}
