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