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