For a graph, the first Zagreb index M1 is equal to the sum of the squares of the degrees of the vertices, and the second Zagreb index M2 is equal to the sum of the products of the degrees of pairs of adjacent vertices. Denote by Gn,k the set of graphs with n vertices and k cut edges. In this paper, we showed the types of graphs with the largest and the second largest M1 and M2 among Gn,k .