#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
const long long MAX = (long long)1e5 + 10;
long long fat[] = {1, 1, 2, 6, 24};
long long comb(int n, int k) {
  long long ret = 1;
  for (int i = 0; i < k; i++) {
    ret *= n - i;
  }
  ret /= fat[k];
  return ret;
}
long long solve(int n, int k) {
  if (k == 1) {
    return 1;
  }
  if (k == 2) {
    return solve(n, k - 1) + comb(n, k);
  }
  if (k == 3) {
    return solve(n, k - 1) + 2 * comb(n, k);
  }
  if (k == 4) {
    return solve(n, k - 1) + 9 * comb(n, k);
  }
  return -1;
}
int main() {
  int n, k;
  cin >> n >> k;
  cout << solve(n, k) << endl;
  return 0;
}
