#include <bits/stdc++.h>
using namespace std;
unsigned long long n, k;
unsigned long long C(unsigned long long n, unsigned long long k) {
  unsigned long long ans = 1;
  for (unsigned long long i = 1; i <= k; i++) {
    ans *= (n - i + 1);
  }
  for (unsigned long long i = 1; i <= k; i++) {
    ans /= (k - i + 1);
  }
  return ans;
}
int main() {
  cin >> n >> k;
  if (k == 1)
    cout << 1 << endl;
  else if (k == 2)
    cout << C(n, 2) + 1 << endl;
  else if (k == 3)
    cout << C(n, 3) * 2 + C(n, 2) + 1 << endl;
  else if (k == 4)
    cout << C(n, 4) * 9 + C(n, 3) * 2 + C(n, 2) + 1 << endl;
  return 0;
}
