Measurement of Cosmic Deuteron Flux with the AMS-02 Detector