Well, I assumed the average runtimes were O(p*l) for the naive and O(p+l) for the horspool algorithm. Therefore, when both algorithms perform equally well p*l = p*k1+l*k2. I made two measurements for different p and l for which they did perform equal, and from those values I calculated k1 and k2. Then I changed the formula so that in can be calculated with integer arithmetic.

You may have noticed that my initial assumptions are wrong. The average runtimes are actually O(l) and O(l/p+p). Still, the formula seems to be a good enough approximation to avoid big mistakes.