Q:

Optimizing a Functional(?) Where Optimized Quantity is a Function of the Integral Upper Bound?

This may be very simple or asked in an overly obtuse way but I'm struggling to figure out how to find stationary values for $A$ w.r.t. $k$ for $x \in (0,a]$: $$A(x,k)=\int_{0}^{x}f(t,k(t))dt\tag{1}$$ given that $k$ subject to the following constraint: $$\int_{0}^{a} k(t) dt = b.\tag{2}$$
I'm not really sure where to go from here since applying Euler Lagrange seems wrong when $A$ is explicitly a function of the upper bound of the integral rather than just of the functions in the integrand. I assume that if something like the E-L equation can be used then the constraint would be handled with a Lagrange multiplier?

A:

Briefly, the stationary condition becomes
$$ \forall t\in[0,x]:~~\frac{\partial f(k(t),t)}{\partial k(t)}~=~0. $$
For $t\in]x,a]$, pick any values of $k(t)$ such that OP's constraint (2) is satisfied.

