T − F_{f} = m_{A}a

T − m_{B}g = −m_{B}a

T = F_{f} + m_{A}a

F_{f} + m_{A}a − m_{B}g = −m_{B}a

F_{f} = m_{B}g − (m_{A} + m_{B})a