#include <bits/stdc++.h>
using namespace std;
long long ans = 0, n, k, c[1010][1010] = {0}, m[6] = {0, 0, 1, 2, 9, 44};
int main() {
  long long n, k, i, j;
  cin >> n >> k;
  c[0][0] = 1;
  for (i = 1; i <= 1000; i++) {
    c[i][0] = 1;
    for (j = 1; j <= i; j++) c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
  }
  for (j = n - k; j <= n - 2; j++) {
    ans += c[n][j] * m[n - j];
  }
  ans++;
  cout << ans << endl;
  return 0;
}
