#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int l, n;
cin >> l >> n;
int count = 0;
int skip = 0;
for (int i = 0; i < n; ++i) {
int board;
cin >> board;
if (skip > 0) {
skip--;
} else if (board == 1) {
count++;
skip = l - 1;
}
}
cout << count << "\n";
return 0;
}