
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;

    string s;
    cin >> s;

    unordered_map<int, int> g;
    g[0] = 1;

    int count = 0;
    int sum = 0;

    for (int j = 0; j < n; j++)
    {
        if (s[j] == '5')
        {
            count = count + 1;
        }

       int v = count - k;
        sum = sum + g[v];
        
        g[count] = g[count] + 1;
    }

    cout << sum <<endl;
}

/*
    input
    7
    2
    0050501

Index:  0 1 2 3 4 5 6
String: 0 0 5 0 5 0 1
The two '5' characters occur at indices 2 and 4.
A substring must start at or before index 2 and end at or after index 4, while excluding any additional '5' characters. There are:
- 3 choices for the starting index: 0, 1, 2
- 3 choices for the ending index: 4, 5, 6
 the answer is 3 * 3 = 9

    */
