#include<iostream>
#include<algorithm>
#include<functional>
#define MAX 1000

int main(){
	int n,m,p[MAX];
	while(1){
		int f=0,m1=0;
		std::cin>>n>>m;
		if(n==0&&m==0)
			break;
		for(int i=0;i<n;++i){
			std::cin>>p[i];
		    m1+=p[i];
		}
		std::sort(p,p+n,std::greater<int>());
		int c=n%m;
		for(int i=0;i<n-c;++i){
			if((i+1)%m==0)
				f+=p[i];
		}
		std::cout<<m1-f<<std::endl;
	}
	return 0;
}
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>=n;i--)
#define INF 999999999
#define INF_M 2147483647
#define pb(a) push_back(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef vector<pii> VP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main() {
    string s;
    while(getline(cin,s)) {
		string t;
		rep(j,0,26) {
			t.clear();
			rep(i,0,s.length()) {
				if('a' <= s[i] && s[i] <= 'z') t += (s[i] + j > 'z') ? (s[i] + j - 26) : (s[i] + j);
				else t += s[i];
			}
			if(t.find("this") != string::npos) break;
			else if(t.find("the") != string::npos) break;
			else if(t.find("that") != string::npos) break;
		}
		cout << t << endl;
	}
    return 0;
}