#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e3 + 10;
long long N, M;
double f[2][MAXN];
int main() {
  scanf("%lld%lld", &N, &M);
  for (long long i = 1; i <= N; i++) {
    for (long long j = 1; j <= min(N, 1000LL); j++) {
      f[i & 1][j] =
          f[(i - 1) & 1][j] * (1.0 - (1.0 / M)) +
          (f[(i - 1) & 1][j + 1] + j) * (1.0 / (M * (j + 1))) +
          (f[(i - 1) & 1][j] + (1 + j) / 2.0) * (j * 1.0 / (M * (j + 1)));
    }
  }
  printf("%.10f\n", f[N & 1][1] * M);
  return 0;
}
