1. 
/**
* Problem: 574 Sum It Up
* Zeit: 0.176
* Programmiersprache: JAVA
* @author Christoph Miesel
* Status: ACCEPTED
*/


import java.util.*;
import java.io.*;

public class Backtrack
{
static int[] array;
static ArrayList<ArrayList<Integer>> res = new ArrayList<ArrayList<Integer>>();
static int counter = 0;
static int S,N;
static ArrayList<Integer> list = new ArrayList<Integer>();

static boolean compare(ArrayList<Integer> l1, ArrayList<Integer> l2)
{
if(l1.size() != l2.size())
return false;
else
{
for(int i = 0; i < l1.size(); ++i)
if(l1.get(i) != l2.get(i))
return false;
}
return true;
}

/** Back-Tracking algorithm */
static void backtrack(int sum, int index, int step)
{
if(sum > S)
{
return;
}

sum += array[index];
list.add(step, array[index]);

if(sum == S)
{
//System.out.println(list);
// make copy of one result
ArrayList<Integer> tmp = new ArrayList<Integer>();
for(int i = 0; i <= step; ++i)
tmp.add(list.get(i));
//System.out.println(list);
boolean isSol = true;

for(ArrayList l: res)
isSol &= !compare(tmp, l);
if(isSol)
{
res.add(tmp);
++counter;
}
list.remove(step);
return;
}

for(int i = index+1; i < array.length; ++i)
{
backtrack(sum, i, step+1);
}
list.remove(step);

}

public static void main(String[] args) throws IOException
{
// organization for reading the input

BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer t = new StringTokenizer(r.readLine());
// reading the input
S = Integer.parseInt(t.nextToken());
N = Integer.parseInt(t.nextToken());

while(S != 0 || N != 0)
{
// fill the array with the number which wants to be summed up
array = new int[N];
for(int i = 0; i < N; ++i)
array[i] = Integer.parseInt(t.nextToken());

// computing all solutions with backtracking and saving every results in a list
for(int i = 0; i < array.length; ++i)
{
list.clear();
backtrack(0, i, 0);
}

// output the result
System.out.println("Sums of "+S+":");
if(counter == 0)
System.out.println("NONE");
else
for(ArrayList<Integer> h: res)
{
for(int i = 0; i < h.size(); ++i)
{
if(i < h.size()-1)
System.out.print(h.get(i)+"+");
else System.out.print(h.get(i));
}
System.out.println();
}

// reading new input
t = new StringTokenizer(r.readLine());
S = Integer.parseInt(t.nextToken());
N = Integer.parseInt(t.nextToken());
res.clear();
list.clear();
counter = 0;
}
}
}