import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int []a=new int[n];
        int k=sc.nextInt();
        HashMap<Integer,Integer> hm = new HashMap<>();
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
            int complement = k-a[i];
            if(hm.containsKey(complement)){
                System.out.println(i+" "+hm.get(complement));
                return;
            }
            hm.put(a[i],i);
        }
        
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: