Solve[-p D[b-ap,p]/(b-ap)==1,p]