Finite element method for a nonsmooth elliptic equation