#include <bits/stdc++.h>
using namespace std;
long long int D[5] = {0, 0, 1, 2, 9};
map<pair<long long int, long long int>, long long int> store;
long long int NCR(long long int n, long long int r) {
  if (n < r) return 0;
  if (r == 0 || r == n) return 1;
  long long int x, y;
  if (store[make_pair(n - 1, r - 1)] != 0)
    x = store[make_pair(n - 1, r - 1)];
  else {
    x = NCR(n - 1, r - 1);
    store[make_pair(n - 1, r - 1)] = x;
  }
  if (store[make_pair(n - 1, r)] != 0)
    y = store[make_pair(n - 1, r)];
  else {
    y = NCR(n - 1, r);
    store[make_pair(n - 1, r)] = y;
  }
  return (x + y);
}
int main() {
  long long int n, k;
  cin >> n >> k;
  long long int ans = 1;
  while (k > 0) {
    ans += ((NCR(n, k)) * (D[k]));
    k--;
  }
  cout << ans << endl;
}
