Optimality conditions in problems of control over systems of impulsive differential equations with nonlocal boundary conditions