#include <bits/stdc++.h>
using namespace std;
namespace output {
void __(short x) { cout << x; }
void __(unsigned x) { cout << x; }
void __(int x) { cout << x; }
void __(long long x) { cout << x; }
void __(unsigned long long x) { cout << x; }
void __(double x) { cout << x; }
void __(long double x) { cout << x; }
void __(char x) { cout << x; }
void __(const char* x) { cout << x; }
void __(const string& x) { cout << x; }
void __(bool x) { cout << (x ? "true" : "false"); }
template <class S, class T>
void __(const pair<S, T>& x) {
  __(1 ? "(" : ""), __(x.first), __(1 ? ", " : " "), __(x.second),
      __(1 ? ")" : "");
}
template <class T>
void __(const vector<T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
template <class T>
void __(const set<T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
template <class T>
void __(const multiset<T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
template <class S, class T>
void __(const map<S, T>& x) {
  __(1 ? "{" : "");
  bool _ = 0;
  for (const auto& v : x) __(_ ? 1 ? ", " : " " : ""), __(v), _ = 1;
  __(1 ? "}" : "");
}
void pr() { cout << "\n"; }
template <class S, class... T>
void pr(const S& a, const T&... b) {
  __(a);
  if (sizeof...(b)) __(' ');
  pr(b...);
}
}  // namespace output
using namespace output;
const int MN = 1e5 + 5, MS = 999;
int N, K, i, j, x, y;
long double f[MS], dp[2][MN], ans;
int main() {
  scanf("%d%d", &N, &K);
  for (i = 1; i < MS; i++) {
    for (j = 1; j <= i; j++) f[i] += j;
    f[i] = (f[i] + i) / (long double)(i + 1);
  }
  dp[1][0] = 1.0;
  for (i = 1; i < MS; i++) {
    for (j = 0; j < N; j++) dp[(i + 1) & 1][j] = 0.0;
    for (j = 0; j < N; j++) {
      ans += i / (long double)K / (long double)i * f[i] * dp[i & 1][j];
      dp[i & 1][j + 1] += ((K - 1) * (i + 1) + i) / (long double)K /
                          (long double)(i + 1) * dp[i & 1][j];
      dp[(i + 1) & 1][j + 1] +=
          1 / (long double)K / (long double)(i + 1) * dp[i & 1][j];
    }
  }
  printf("%.10Lf\n", ans * K);
  return 0;
}
