#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:128000000")
const int maxl = 750;
int n, k;
double f[maxl];
double prec[maxl];
double nprec[maxl];
double me[maxl];
int main() {
  cin >> n >> k;
  double nk = 1.0 / (double)k;
  for (int i = 1; i < maxl; ++i) {
    me[i] = (double)(i + 1) / 2.0;
    prec[i] = (1.0 / (double)(i + 1));
    nprec[i] = (1.0 - prec[i]);
    prec[i] *= nk;
    nprec[i] *= nk;
  }
  double res = 0.0;
  memset(f, 0, sizeof f);
  f[1] = 1.0;
  for (int i = 0; i < n; ++i) {
    double cf, dif;
    for (int j = min(maxl - 2, i + 1); j; --j) {
      cf = f[j];
      dif = prec[j] * cf;
      f[j + 1] += dif;
      res += nprec[j] * cf * me[j];
      res += dif * (double)j;
      f[j] = cf - dif;
    }
  }
  cout.precision(15);
  cout << fixed << res * (double)k << endl;
  return 0;
}
