#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)1e5 + 10, K = 500 + 10;
int n, k;
long double f[2][MAXN], logfac[MAXN], logp[MAXN], logp1[MAXN];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i <= n; ++i) f[(K - 1) & 1][i] = (long double)i * K / 2;
  for (int i = K - 2; i >= 1; --i)
    for (int j = 1; j <= n; ++j)
      f[i & 1][j] = (f[i & 1][j - 1] + (long double)(i + 1) / 2) *
                        ((long double)i / (i + 1)) +
                    (f[(i + 1) & 1][j - 1] + i) * (1.0 / (i + 1));
  for (int i = 1; i <= n; ++i)
    logfac[i] = logfac[i - 1] + log((long double)i),
    logp[i] = logp[i - 1] + log((long double)k),
    logp1[i] = logp1[i - 1] + log((long double)(k - 1));
  long double Tohka = 0;
  for (int i = 1; i <= n; ++i) {
    long double p =
        logfac[n] - logfac[i] - logfac[n - i] + logp1[n - i] - logp[n - 1];
    p = exp(p);
    Tohka += p * f[1][i];
  }
  cout << setprecision(10);
  cout << fixed << Tohka << endl;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
