This paper is concerned with the number of limit cycles of nonsmooth differential systems [Formula: see text] under nonsmooth perturbations of polynomials of degree at most [Formula: see text], where [Formula: see text]. We first obtain the detailed expansion of the first Melnikov function by computing its generators for [Formula: see text]. Then by using the expansion, we give the upper bounds for the number of limit cycles bifurcating from each period annulus for two cases: [Formula: see text] [Formula: see text] [Formula: see text] and [Formula: see text] [Formula: see text].