#include <bits/stdc++.h>
using namespace std;
long long int mod = 1000000007;
long long int ans_k(long long int k, long long int n) {
  if (k == 0)
    return 1;
  else if (k == 1)
    return 0;
  else if (k == 2)
    return ((n * (n - 1)) / (1 * 2));
  else if (k == 3)
    return ((n * (n - 1) * (n - 2)) / (1 * 2 * 3)) * 2;
  else if (k == 4)
    return ((n * (n - 1) * (n - 2) * (n - 3)) / (1 * 2 * 3 * 4)) * 9;
  else
    return -1;
}
int main() {
  long long i, n, k, ans = 0;
  scanf("%lld", &n);
  scanf("%lld", &k);
  for (i = k; i >= 0; i--) {
    ans += ans_k(i, n);
  }
  printf("%lld\n", ans);
  return 0;
}
