1401
#include<iostream> #include<set> using namespace std; int main(){ int m,n,x=0,c[1000],p=-1; set<int> a; cin>>m>>n; int b; set<int>::iterator i; for(int i=0;i<n;i++){ cin>>b; if(a.find(b)==a.end()){ x++; a.insert(b); if(a.size()<=m){ p++; p=p%m; c[p]=b; }else{ p++; p=p%m; a.erase(c[p]); c[p]=b; } } } cout<<x<<endl; return 0; }