#include <bits/stdc++.h>
using namespace std;
uintmax_t combination(unsigned int n, unsigned int r) {
  if (r * 2 > n) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor = 1;
  for (unsigned int i = 1; i <= r; ++i) {
    dividend *= (n - i + 1);
    divisor *= i;
  }
  return dividend / divisor;
}
int main(int argc, const char* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K, i;
  long long int ans = 0;
  cin >> N >> K;
  for (i = K; i < N + 1; i++) {
    ans += combination(N + 1, i);
  }
  cout << ans << endl;
  return 0;
}
