The sum of the degrees of the vertices of $G$ equals twice the number of edges. This follows by double-counting the pairs $(x,e)$ where $x$ is a vertex and $e$ is an edge having $x$ as one of its endpoints. Counting over vertices, there are $\sum_x d(x)$ such pairs as there are $d(x)$ such pairs having $x$ as a vertex (here $d(x)$ denotes the degree of $x$). Counting over edges, there are $2m$ such pairs since there are $2$ such pairs for each edge, $m$ being the number of edges. It follows that $\sum_x d(x) = 2m$.
For a) your answer is correct. For b), in a $k$-regular graph with $p$ vertices the sum of the degrees equals $kp$, hence there are $kp/2$ edges (which shows there are no regular graphs having an odd number of vertices where each vertex has odd degree).