package Main; import java.io.InputStream; import java.util.Scanner; public class Main { public static long constant = 1000000007; public static void main(String[] args) { Scanner in = new Scanner(System.in); long k = in.nextLong(); long l = in.nextLo…