#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const double PI = atan(1.0) * 4;
const int inf = ~0u >> 1;
const int Dx[] = {1, 0, -1, 0}, Dy[] = {0, 1, 0, -1};
template <class T>
bool chmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool chmax(T& a, const T& b) {
  return b > a ? a = b, 1 : 0;
}
template <class T>
int sgn(T first) {
  return (first > eps) - (first < -eps);
}
double d[2][1111];
int main() {
  int n, k;
  cin >> n >> k;
  int up = 700, now = 0, nxt = 1;
  for (int i = (n); i >= (int)(1); i--) {
    for (int j = (1); j <= (int)(up); j++) {
      d[nxt][j] =
          (k - 1.0) / k * d[now][j] +
          (j * d[now][j] + d[now][j + 1] + j * (j + 3) / 2) / k / (j + 1);
    }
    swap(now, nxt);
  }
  printf("%.12f\n", d[now][1] * k);
  return 0;
}
