#include using namespace std; const int N = 1010; int m, n, cnt; //思路:队列+桶 bool b[N]; //判断该数是否在内存中,桶。 queue q; //定义一个队列 int main() { cin >> m >> n; for (int i = 1; i <= n; i++) { int t; cin >> t; if (!b[t]) { q.push(t); b[t] = true; cnt++; if (q.size() > m) { b[q.front()] = false; q.pop(); } } } printf("%d", cnt);//输出计数 return 0; }