#include <iostream> #include <stdio.h> #include <string> #include <string.h> #include <algorithm> #include <math.h> #include <fstream> #include <vector> #include <map> #include <queue> #include <stack> #include <math.h> #include <stdlib.h> using namespace std ; const int maxn = 15; int x[maxn]; int t,n,sum,remain; int vis[maxn]; int f_flag; void dfs(int id){ if(id==n||sum >= t){ if(sum == t){ f_flag = 0; int flag = 0; for(int i = 0;i < n;i++){ if(vis[i]){ if(flag) printf("+%d",x[i]); else{ printf("%d",x[i]); flag = 1; } } } printf("\n"); } return; } if(sum+x[id] <= t && x[id] != remain){ sum += x[id]; vis[id] = 1; dfs(id+1); sum -= x[id]; vis[id] = 0; } remain = x[id];//记录上一个 dfs(id+1); } int main(){ while(scanf("%d%d",&t,&n)&&(t+n)){ for(int i = 0;i < n;i++) scanf("%d",x+i); memset(vis,0,sizeof(vis)); sum = 0;remain = 0; f_flag = 1; printf("Sums of %d:\n",t); dfs(0); if(f_flag) printf("NONE\n"); } return 0 ; }