#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i) {
    if (i != v.begin()) os << ", ";
    os << *i;
  }
  os << "]";
  return os;
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  const int T = 600;
  vector<double> D(T + 2, 0);
  for (int i = 0; i < (int)(n); ++i) {
    vector<double> nD(T + 2, 0);
    for (int el = (int)(1); el <= (int)(T); ++el)
      nD[el] = (1 - 1.0 / k) * D[el] +
               (el * (D[el] + (el + 1) / 2.0) + D[el + 1] + el) / k / (el + 1);
    D.swap(nD);
  }
  printf("%.12lf\n", k * D[1]);
}
