For $a \in \mathbb{R}$ we define the function $f_a$ as: $$f_a(x) = \begin{cases} x - a; & \text{if } x \geq a \newline 0; & \text{otherwise} \end{cases}.$$
Let X and Y be random variables with integer values for which $E(|X|), E(|Y|) < \infty$. Let's assume that for every $x \in \mathbb{R}$ the following is true: $$P(X > x) \leq P(Y > x).$$
Prove that for every $a \in \mathbb{R}$ the following is true as well: $$E[f_a(X)] \leq E[f_a(Y)].$$
I assume that the key part is the fact that $f_a(X)$ and $f_a(Y)$ are both nonnegative random variables. I know that $E(X) = \sum_{n = 0}^{\infty}P(X > n)$ and I've tried solving the problem using these two facts but I couldn't really figure out how to use them.
\begin{align}Ef_a(X)&=\int_0^{\infty} P(f_a(X) >t)dt\\&=\int_0^{\infty} P(X > a, X>a+t)\\ &\leq \int_0^{\infty} P(Y > a, Y>a+t)\\&=Ef_a(Y)\end{align}
The inequality here follows from the hypothesis since $X>a,X>a+t$ is equivalent to $X>a_t$ and $Y>a,Y>a+t$ is equivalent to $Y>a_t$ where $a_t=\max\{a, a+t\}$.