#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, x;
  cin >> n >> x;
  string s;
  cin >> s;
  for(int i=0; i<s.size();++i){
    if(s.at(i)=='o') x++;
    else if(x > 0) x--;
  }
  cout << x << endl;
}
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define re return
#define all(a) a.begin(),a.end()
#define int long long
#define rept(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,a) rept(i,0,a)
#define vi vector<int>
#define vvi(_Name,_Height,_Width) vector<vi>_Name(_Height,vi(_Width))
#define vvi_v(_Name,_Height,_Width,_Value) vector<vi>_Name(_Height,vi(_Width,_Value))
#define pii pair<int,int>
using namespace std;
void fail(string s){ cout<<s;exit(0); }
void fail(int s){ cout<<s;exit(0); }
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
vi v[2000];
vi use(2000);
int n,m;
int dfs(int u){
	use[u]=1;
	int ans=1;
	for(int i:v[u]){
		if(!use[i])
			ans+=dfs(i);
	}
	re ans;
}
void run_test_case(){
	cin>>n>>m;
	rep(i,m){
		int a,b;
		cin>>a>>b;
		v[a-1].pb(b-1);
	}
	int ans=0;
	rep(i,n){
		rep(_,n)use[_]=0;
		ans+=dfs(i);
	}
	cout<<ans<<'\n';
}
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int test_cases=1;
//	cin>>test_cases;
	while(test_cases--)
		run_test_case();
	re 0;
}
