InAs avalanche photodiodes as X-ray detectors