2020-09-26 11:38:13 +00:00
|
|
|
// R38909558
|
|
|
|
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int main() {
|
2021-11-19 09:01:13 +00:00
|
|
|
int m, n, t, f = 0, ans = 0;
|
|
|
|
bool flag = false;
|
2020-09-26 11:38:13 +00:00
|
|
|
vector<int> memory;
|
2021-11-19 09:01:13 +00:00
|
|
|
queue<int> mq;
|
2020-09-26 11:38:13 +00:00
|
|
|
cin >> m >> n;
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
cin >> t;
|
|
|
|
ans++;
|
|
|
|
flag = false;
|
|
|
|
for (int j = f; j < memory.size(); j++) {
|
|
|
|
if (memory[j] == t) {
|
|
|
|
ans--;
|
|
|
|
flag = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!flag) {
|
|
|
|
memory.push_back(t);
|
|
|
|
mq.push(t);
|
|
|
|
}
|
|
|
|
if (mq.size() > m) {
|
|
|
|
f++;
|
|
|
|
mq.pop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cout << ans << endl;
|
|
|
|
return 0;
|
|
|
|
}
|