In order to apply the usual fmincon to any problem you should define your objective function (Min. | s1 - k1 | + | s2- k2 |)
and your constraints as numerical functions. So, the point is how to define a function as definite integral function. You can do that using the matlab function quadv.
However, I have to say that your problem MAY be not correctly formulated. Note that if f(x) is a distribution function defined on a support [0,M] (it seems to be the gamma function or some variation of it) integral_from_0_to_M of f(x)
is always equal to 1. If it is not defined on the support [0,M], integral_from_0_to_M of f(x)
will never be equal to 1. So maybe this constraint is not necessary or never satisfied. I didnt check carefully your case, but be sure that the choice of alpha and beta by themselves ensure that this constraint is satisfied.
Furthermore, this is a very unusual way to define a distribution function with parameters ExpectedValue=k1 and Variance=k2. Is it not possible analytically to redefine a the Gamma function in the support [0,M] i.e. a truncated Gamma function? See how people do that with truncated normal distributions...