  We examine the quantity \[S(G) = \sum_{uv\in E(G)} \min(\text{deg } u,
\text{deg } v)\] over sets of graphs with a fixed number of edges. The main
result shows the maximum possible value of $S(G)$ is achieved by three
different classes of constructions, depending on the distance between the
number of edges and the nearest triangular number. Furthermore we determine the
maximum possible value when the set of graphs is restricted to be bipartite, a
forest or to be planar given sufficiently many edges. The quantity $S(G)$
corresponds to the difference between two well studied indices, the
irregularity of a graph and the sum of the squares of the degrees in a graph.
These are known as the first and third Zagreb indices in the area of
mathematical chemistry.
