#include <iostream>
using namespace std;
int n, k;
long long f(int x, int num)
{
if (x > num)
return 0;
if (x == 1)
return 1;
return x * f(x, num - 1) + f(x - 1, num - 1);
}
int main()
{
cin >> n >> k;
long long ans = f(k, n);
cout << ans;
return 0;
}