#include <bits/stdc++.h>
using namespace std;
const int B = 551;
double f[2][B + 5];
int T, n, k, cur;
int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  cin >> n >> k;
  cur = 0;
  for (int i = 1; i <= n; i++) {
    cur ^= 1;
    for (int j = 1; j <= n && j <= B; j++)
      f[cur][j] = ((f[cur ^ 1][j] + (long double)(j + 1) / 2.0) *
                       (long double)j / (j + 1) +
                   (f[cur ^ 1][j + 1] + j) / (j + 1)) /
                      k +
                  (long double)(k - 1) / k * f[cur ^ 1][j];
  }
  cout << f[cur][1] * k;
  return 0;
}
