#include <bits/stdc++.h>
using namespace std;
long long select(long long n, long long k) {
  if (k == 2) {
    return (n * (n - 1)) / 2;
  }
  if (k == 3) {
    return (n * (n - 1) * (n - 2)) / 6;
  }
  if (k == 4) {
    return (n * (n - 1) * (n - 2) * (n - 3)) / 24;
  }
  return 0;
}
long long d(long long num) {
  if (num == 2) {
    return 1;
  }
  if (num == 3) {
    return 2;
  }
  return 9;
}
int main() {
  long long n, k;
  cin >> n >> k;
  if (k == 1) {
    cout << 1 << endl;
    return 0;
  }
  long long ans = 0;
  while (k != 1) {
    long long count = select(n, k);
    ans += count * d(k);
    --k;
  }
  ++ans;
  cout << ans << endl;
}
