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