#include <bits/stdc++.h>
using namespace std;
long long power(long long b, long long exp, long long m) {
  long long ans = 1;
  b %= m;
  while (exp) {
    if (exp & 1) ans = (ans * b) % m;
    exp >>= 1;
    b = (b * b) % m;
  }
  return ans;
}
long long combi(int d, int l) {
  int k = d - l;
  unsigned long long ans1 = 1, ans2 = 1;
  for (int i = d, j = l; (i > k || j > 0); i--, j--) {
    if (i > k) {
      ans1 *= i;
    }
    if (j > 0) {
      ans2 *= j;
    }
  }
  return ((ans1 / ans2));
}
int main() {
  int n, k;
  cin >> n >> k;
  int d[4] = {0, 1, 2, 9};
  unsigned long long result = 1;
  for (; k > 1; k--) {
    result += combi(n, k) * d[k - 1];
  }
  cout << result << "\n";
}
