See code:
In[13]:= z[x_] = (1 - f[x]/M)^a f[x]
Out[13]= f[x] (1 - f[x]/M)^a
In[14]:= D[z[x], x]
Out[14]= -((a f[x] (1 - f[x]/M)^(-1 + a) Derivative[1][f][x])/
M) + (1 - f[x]/M)^a Derivative[1][f][x]
In[15]:= Simplify[-((
a f[x] (1 - f[x]/M)^(-1 + a) Derivative[1][f][x])/
M) + (1 - f[x]/M)^a Derivative[1][f][x]]
Out[15]= ((M - (1 + a) f[x]) (1 - f[x]/M)^a Derivative[1][f][x])/(M -
f[x])