Giants win NFC East, beat Cowboys 31-14