#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;

int main(){
    int hosei[]={0,4,0,1,4,6,2,4,0,3,5,1,3};
    string day[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
    int m,n;
    while(1){
        cin>>m>>n;
        if(!(m||n))break;
        cout<<day[(hosei[m]+n%7-1)%7]<<endl;
    }
    
    
    return 0;
}
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int main(int argc, char const* argv[])
{
	int n,m;
	int place[1000];

	while( cin >> n >> m && n != 0 ){
		for( int i = 0;i < 1000;i++ ) place[i] = 0;

		for( int i = 0;i < n;i++ ) cin >> place[i];
		sort( place, place + n, greater<int>() );

		for( int i = 1;i * m - 1 < n;i++ ) place[i * m - 1] = 0;
		
		int answer = 0;
		for( int i = 0;i < n;i++ ) answer += place[i];

		cout << answer << endl;
	}

	return 0;
}