#include <iostream>
#include <vector>
#include <map>
using namespace std;
int N, M;
void BFS(vector<int>start, int count, map<int, int>MAP)
{
vector<int>newStart;
map<int, int>exist;
for (int i = 0; i<start.size(); i++)
{
int left = start[i] - 1, right = start[i] + 1;
if (left < 1) left = N;
if (right > N) right = 1;
if (exist[left] == 0) newStart.push_back(left);
if (exist[right] == 0) newStart.push_back(right);
exist[left] += MAP[start[i]];
exist[right] += MAP[start[i]];
}
if (count == M-1)
{
cout << exist[1] << "\n";
return;
}
BFS(newStart, count+1, exist);
}
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
cout.sync_with_stdio(0);
cout.tie(0);
cin >> N >> M;
if (M == 1) cout << "0\n";
else
{
vector<int>start;
start.push_back(1);
map<int, int>MAP;
MAP[1] = 1;
BFS(start, 0, MAP);
}
}