Java program to check if any valid sequence is divisible by M
import java . util . * ; class GFG { static final int MAX = 1000 ; static boolean isPossible ( int n , int index , int sum , int M , int arr [ ] , int dp [ ] [ ] ) {