Technically, you wrote the first.
What ideas have you had so far?
I doubt that you're asked to treat k as a variable. When I see this sort of maximization problem, I think of maximizing g as a function of s (note that you have g(s), not g(s,k)). Since you have a parabola, there are two methods of solving this problem. You could do the calculus method of taking the derivative and setting it equal to zero. Or, if you feel uncomfortable with that, then just complete the square. Pick a method, and see what happens.