#include <bits/stdc++.h>
using namespace std;
const int LN = 666;
const int FN = 111111;
double mem[2][LN];
double K, noK;
int main() {
  int n, k;
  cin >> n >> k;
  K = double(1) / k;
  noK = double(k - 1) / k;
  double *fw = mem[0], *fr = mem[1];
  for (int fi = 1; fi <= n; ++fi) {
    for (int l = 1; l < LN - 1; ++l) {
      double& ans = fw[l] = 0;
      ans += fr[l] * l / (l + 1) + l / 2.0;
      ans += (fr[l + 1] + l) / (l + 1);
      ans = ans * K + fr[l] * noK;
    }
    swap(fw, fr);
  }
  cout.precision(20);
  cout << k * fr[1] << endl;
  return 0;
}
