public static int backPack1(int m, int[] A) {
        // write your code here
        int n=A.length;
        boolean[] t=new boolean[m+1];
        t[0]=true;
        int rel=0;
        for (int i=1;i<=m;++i) {
            for (int j=0;j<n;++j) {
                if (i-A[j]>=0&&t[i-A[j]]) {
                    t[i]=true;
                    rel=Math.max(rel,i);
                }
            }
        }
        return rel;
    }