/**********************************************************************
 * 
 * First of all it should be clear that Steve will always win, since he
 * has the best strategy. The others will never beat him and even if
 * they tie the applepie lets Steve win anyway. So we only concentrate
 * on Steve. This is a little simulation problem, we just have to do
 * what Steve would do. Sort the problems by increasing difficulty and
 * then solve them in this order until time runs out, counting the number
 * of solved problems and keeping track of the score.
 * 
 **********************************************************************/

#include <iostream>
#include <algorithm>
using namespace std;

int main () {
  int SC;
  cin >> SC;
  for( int S=1; S<=SC; S++ ){
    cout << "Scenario #" << S << ":" << endl;
    
    //--- Read the test case.
    int m, p;
    cin >> m >> p;
    int t[24];
    for( int i=0; i<p; i++ )
      cin >> t[i];
    
    //--- Sort.
    sort( t, t+p );
    
    //--- Analyze.
    int solved = 0, score = 0, sum = 0;
    for( int i=0; i<p; i++ ){
      sum += t[i];
      if( sum <= m ){
	solved++;
	score += sum;
      }
    }
    
    //--- Answer.
    cout << "Steve wins with " << solved << " solved problems and a score of " << score << "." << endl << endl;
  }
}
