#include <iostream>
#include <string>
using namespace std;
int main()
{
int n, k, m=0 ,ans=0;
string s;
cin >> n >> k;
cin >> s;
for(int i = 0; i < k; i++)m += ( s[i] == '(' ) ? 1 : -1;
k--;
if(s[0] == '(' && s[k] == ')' && m == 0)ans++;
for(int i = 1; i < n-k; i++){
m += ( s[i-1] == '(' ) ? -1 : 1;
m += ( s[i+k] == ')' ) ? -1 : 1;
if(s[i] == ')') continue;
if(s[i+k] == '(') continue;
if(m)continue;
ans++;
};
cout << ans;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewogICAgaW50IG4sIGssIG09MCAsYW5zPTA7CiAgICBzdHJpbmcgczsKICAgIGNpbiA+PiBuID4+IGs7CiAgICBjaW4gPj4gczsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBrOyBpKyspbSArPSAoIHNbaV0gPT0gJygnICkgPyAxIDogLTE7CiAgICBrLS07CiAgICBpZihzWzBdID09ICcoJyAmJiBzW2tdID09ICcpJyAmJiBtID09IDApYW5zKys7CiAgICBmb3IoaW50IGkgPSAxOyBpIDwgbi1rOyBpKyspewogICAgICAgIG0gKz0gKCBzW2ktMV0gPT0gJygnICkgPyAtMSA6IDE7CiAgICAgICAgbSArPSAoIHNbaStrXSA9PSAnKScgKSA/IC0xIDogMTsKICAgICAgICBpZihzW2ldID09ICcpJykgY29udGludWU7CiAgICAgICAgaWYoc1tpK2tdID09ICcoJykgY29udGludWU7CiAgICAgICAgaWYobSljb250aW51ZTsKICAgICAgICBhbnMrKzsKICAgICAgICB9OwogICAgY291dCA8PCBhbnM7CiAgICByZXR1cm4gMDsKfQo=