#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = 998244353ll;

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

bool done[3333][3333];
ll memo[3333][3333];

ll solve(int n, int k){
	int j;
	if(n<k){
		return 0ll;
	}
	// std::cout << n << " " << k << std::endl;
	if(done[n][k]){
		return memo[n][k];
	}
	done[n][k] = true;
	if(!k){
		return memo[n][k] = (!n); 
	}
	for(j=k; j<=n+1; j*=2){
		add_mod(memo[n][k],solve(n-1,j-1));
	}
	return memo[n][k];
}

int main(void){
	int n,k;
	std::cin >> n >> k;
	std::cout << solve(n,k) << std::endl;
	return 0;
}

//#include <GOD>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
#define pb push_back
#define len length	
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define freo freopen("output.txt","w",stdout)
#define frei freopen("input.txt","r",stdin)

const ll inf=1e18;
const ll mod=1e9+7;
const ll maxn=1e5+10,lg=20;
int main(){
	FAST_IO;
	string s,t;
	ll tmps=0,tmpt=0;
	cin>>s>>t;
	for(int i=0;i<s.len();i++){
		tmps+=s[i]-'0';
	}
	for(int j=0;j<t.len();j++){
		tmpt+=t[j]-'0';
	}
	cout<<max(tmps,tmpt)<<endl;
}
