#include <bits/stdc++.h>
using namespace std;
string q;
int n, m = 0;
int yi[1000001];
int main() {
  cin >> n >> q;
  for (int a = 0; a < q.size(); a++)
    if (q[a] == '1') yi[++m] = a + 1;
  if (n == 0) {
    long long we = 0;
    for (int a = 1; a <= m; a++)
      we += 1LL * ((yi[a] - yi[a - 1] - 1) + 1) * (yi[a] - yi[a - 1] - 1) / 2;
    we += 1LL * (q.size() - yi[m]) * (q.size() - yi[m] + 1) / 2;
    cout << we;
    return 0;
  }
  long long jg = 0;
  for (int a = 1, b = n; a <= m && b <= m; a++, b++) {
    if (b == m) {
      jg += 1LL * (yi[a] - yi[a - 1]) * (q.size() - yi[b] + 1);
      continue;
    }
    jg += 1LL * (yi[a] - yi[a - 1]) * (yi[b + 1] - yi[b]);
  }
  cout << jg;
}
