text: #include <cstdlib>
  #include <iostream>
  #include <cstdio>
  #include <cctype>
  #include <cstring>
  #include <algorithm>
  #include <queue>
  #include <vector>
  #include <set>
  
  #ifdef D
  //#include <custom/Debug.hpp>
  #endif
  
  //using namespace std;
  using std::string;
  
  #if (defined LOCAL) || (defined D)
  #define DEBUG(...) fprintf(stderr,__VA_ARGS__)
  #define PRINTARR(formatstr, arr, beginoff, size)				\
  do{fprintf(stderr,#arr ":");									\
  for (int __i = beginoff; __i <= beginoff + size - 1; __i++)		\
  	fprintf(stderr,"\t%d", __i);								\
  fprintf(stderr,"\n");											\
  for (int __i = beginoff; __i <= beginoff + size - 1; __i++)		\
  	fprintf(stderr,"\t" formatstr, arr[__i]);					\
  fprintf(stderr,"\n"); }while(false)
  #define PASS fprintf(stderr,"Passing function \"%s\" on line %d\n", __func__, __LINE__)
  #define ASSERT(expr) do{\
  	if(!(expr)){\
  		fprintf(stderr,"Debug Assertion Failed on line %d, in function %s:\n  Expression: %s\n",__LINE__,__func__,#expr);\
  		abort();\
  	}\
  }while(false)
  #define PRINTARR2D(formatstr, arr, beginoff, size, beginy, sizey)\
  do{fprintf(stderr,#arr ":");									\
  for (int __i = beginy; __i <= beginy + sizey - 1; __i++)		\
  	fprintf(stderr,"\t%d", __i);								\
  fprintf(stderr,"\n");											\
  for (int __i = beginoff; __i <= beginoff + size - 1; __i++) {	\
  	fprintf(stderr, "%d:", __i);								\
  	for(int __j = beginy; __j <= beginy + sizey -1; __j++)		\
  		fprintf(stderr,"\t" formatstr, arr[__i][__j]);			\
  	fprintf(stderr, "\n");										\
  }}while(false)
  #define PRINT(...) dbg(__VA_ARGS__)
  #define PRINTVAL(...) dbgv(__VA_ARGS__)
  #define PRINTSEQ(...) dbgr(__VA_ARGS__)
  #define PRINTSEQVAL(...) dbgm(__VA_ARGS__)
  #define PRINTCOMPACT(...) dbgs(__VA_ARGS__)
  #else
  #define DEBUG(...)
  #define PRINTARR(a, b, c, d)
  #define PRINTARR2D(a, b, c, d, e, f)
  #define PASS
  #define ASSERT(expr)
  #define PRINT(...)
  #define PRINTVAL(...)
  #define PRINTSEQ(...)
  #define PRINTSEQVAL(...)
  #define PRINTCOMPACT(...)
  #endif
  
  #define FOR(i, first, last)               for(int i = (first); i <= (last); ++i)
  #define ROF(i, last, first)               for(int i = (last); i >= (first); --i)
  #define FORSTEP(i, first, last, step)     for(int i = (first); i <= (last); i += (step))
  #define ROFSTEP(i, last, first, stepabs)  for(int i = (last); i >= (first); i -= (stepabs))
  
  template<typename IntType>
  void read(IntType& val) {
  	val = 0;
  	int c;
  	bool inv = false;
  	while (!isdigit(c = getchar()))
  		if (c == '-')
  			inv = true;
  	do {
  		val = (val << 1) + (val << 3) + c - '0';
  	} while (isdigit(c = getchar()));
  	if (inv)
  		val = -val;
  }
  template<>
  void read<string>(string& str){
  	str.clear();
  	int c;
  	while(iscntrl(c=getchar())||c==' '||c=='\t');
  	do{
  		str.push_back(c);
  	}while(!(iscntrl(c=getchar())||c==' '||c=='\t'));
  }
  #if __cplusplus >= 201103
  template<typename IntType,typename... Args>
  void read(IntType& val, Args&... args){
  	read(val); read(args...);
  }
  #endif
  
  // End of template:edgar:edgar-laptop(LAPTOP-EDGAR-15)
  
  const int MaxN=500000+10;
  
  int n,k,m;
  int a[MaxN],next[MaxN];
  int cur[MaxN];
  
  struct cmp{
  	bool operator()(int x,int y)const{
  		return next[x]<next[y];
  	}
  };
  
  std::priority_queue<int,std::vector<int>,cmp> Q;
  std::set<int> s,sp;
  
  
  
  int main(int argc, char* argv[]) {
  
  	read(n);read(k);read(m);
  	FOR(i,1,m)
  		read(a[i]);
  
  	FOR(i,1,n)
  		cur[i]=m+1;
  	ROF(i,m,1){
  		next[i]=cur[a[i]];
  		cur[a[i]]=i;
  	}
  
  	PRINTARR("%d",next,1,m);
  
  	int ans=0;
  	FOR(i,1,m){
  		if(s.insert(a[i]).second){
  			if(s.size()>k){
  				DEBUG("i=%02d: pushing %d into set, popping (i=%d, a[i]=%d)\n",i,a[i],Q.top(),a[Q.top()]);
  				s.erase(a[Q.top()]);
  				Q.pop();
  			}else{
  				DEBUG("i=%02d: pushing %d into set, not popping\n",i,a[i]);
  			}
  			Q.push(i);
  			ans++;
  		}else{
  			DEBUG("i=%02d, not pushing\n",i);
  			Q.push(i);
  		}
  	}
  
  	printf("%d\n",ans);
  
  	return 0;
  }
  
  // vim:cindent:cinwords+=FOR,ROF,FORSTEP,ROFSTEP
  
  