#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  char ch;
  bool flag = false;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') flag = true;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  x = flag ? -x : x;
}
inline void write(int x) {
  static const int maxlen = 100;
  static char s[maxlen];
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (!x) {
    putchar('0');
    return;
  }
  int len = 0;
  for (; x; x /= 10) s[len++] = x % 10 + '0';
  for (int i = len - 1; i >= 0; --i) putchar(s[i]);
}
double f[720][2];
int n, m;
int main() {
  int pre = 0, now = 1;
  read(n);
  read(m);
  f[710][0] = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 700; j++) {
      f[j][now] = (m - 1.0) / m * f[j][pre] +
                  1.0 / m / (j + 1) *
                      (j * f[j][pre] + (j + 1) * j / 2 + f[j + 1][pre] + j);
    }
    swap(now, pre);
  }
  printf("%.10f\n", m * f[1][pre]);
  return 0;
}
