代码如下qwq:
#include <iostream>
#include <queue>
using namespace std;
int ans, m, n, t;
bool searched[1005];
queue<int> a;
int main(){
cin >> m >> n;
for(int i = 1; i <= n; i++){
cin >> t;
if(!searched[t]){
ans++;
a.push(t);
searched[t] = true;
}
if(a.size() >= m){
searched[a.front()] = false;
a.pop();
}
}
cout << ans << endl;
return 0;
}