#include<iostream>
using namespace std;
int m, n, now, ans;
bool state;
int memory[105];
int main() {
cin >> m >> n;
int t = 1;
for (int i = 1; i <= n; i++) {
state = 1;
cin >> now;
for (int j = 1; j <= m; j++) {
if (memory[j] == now) {
state = 0;
}
}
if (state) {
if (t < m) {
memory[t] = now;
t++;
} else {
memory[t] = now;
t = 1;
}
ans++;
}
}
cout << ans;
return 0;
}