import java.math.*; import java.util.*; public class Main { static int n; static int[] c; static int[] v; static int[] dp; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); n = sc.nextInt(); dp=new int[t+1]; c=new int[n]; v=new int[n]; for(int i=0;i0){ for(int j=t;j>=c[i]*count;j--){ dp[j]=Math.max(dp[j],dp[j-c[i]]+cur); } cur/=2; count++; } } System.out.println(dp[t]); } }