#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define FOR(i, N) for(int i = 0; i < N; i++)
#define FOR1e(i, N) for(int i = 1; i <= N; i++)
#define REP(i, M, N) for(int i = M; i < N; i++)
#define REPe(i, M, N) for(int i = M; i <= N; i++)
#define sc(N) scanf("%d", &N)
#define scsc(M, N) scanf("%d %d", &M, &N)
#define gt(s) getline(cin, s)
#define all(s) s.begin(), s.end()
#define ll long long
#define vi vector <int>
#define pii pair <int, int>
#define ss stringstream
#define pq priority_queue
#define mp make_pair
#define pb push_back
#define ms(a, v) memset(a, v, sizeof a)
const int MAX = 1e5 + 1;
const int MOD = 1988;
int dr[] = {0, -1, 0, 1};
int dc[] = {1, 0, -1, 0};
inline int Pow(int b, int p) {if(!p) return 1; int sq = Pow(b, p >> 1); sq *= sq; if(p&1) sq *= b; return sq;}
inline int gcd(int a, int b) {if(!a) return b; return gcd(b % a, a);}
int n, k;
ll dp[5005][5005];
ll solve(int rem, int cur, int last){
if(cur == k)
return rem == 0;
if(!rem)
return 0;
ll &ret = dp[rem][cur];
if(ret != -1)
return ret;
ret = 0;
REPe(i, last, rem)
ret = (ret % MOD + solve(rem - i, cur + 1, i) % MOD) % MOD;
return ret;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
while(scsc(n, k) != EOF){
if(!n && !k)
break;
ms(dp, -1);
printf("%lld\n", solve(n, 0, 1));
}
return 0;
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGJpdHNldD4KI2luY2x1ZGUgPGNsaW1pdHM+CiNpbmNsdWRlIDxjbWF0aD4KI2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGNzdHJpbmc+CiNpbmNsdWRlIDxjdGltZT4KI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25zdCBpbnQgTU9EID0gMTk4ODsKCmludCBkcltdID0gezAsIC0xLCAwLCAxfTsKaW50IGRjW10gPSB7MSwgMCwgLTEsIDB9OwoKaW5saW5lIGludCBQb3coaW50IGIsIGludCBwKSB7aWYoIXApIHJldHVybiAxOyBpbnQgc3EgPSBQb3coYiwgcCA+PiAxKTsgc3EgKj0gc3E7IGlmKHAmMSkgc3EgKj0gYjsgcmV0dXJuIHNxO30KaW5saW5lIGludCBnY2QoaW50IGEsIGludCBiKSB7aWYoIWEpIHJldHVybiBiOyByZXR1cm4gZ2NkKGIgJSBhLCBhKTt9CgppbnQgbiwgazsKbGwgZHBbNTAwNV1bNTAwNV07CgpsbCBzb2x2ZShpbnQgcmVtLCBpbnQgY3VyLCBpbnQgbGFzdCl7CiAgICBpZihjdXIgPT0gaykKICAgICAgICByZXR1cm4gcmVtID09IDA7CiAgICBpZighcmVtKQogICAgICAgIHJldHVybiAwOwogICAgbGwgJnJldCA9IGRwW3JlbV1bY3VyXTsKICAgIGlmKHJldCAhPSAtMSkKICAgICAgICByZXR1cm4gcmV0OwogICAgcmV0ID0gMDsKICAgIFJFUGUoaSwgbGFzdCwgcmVtKQogICAgICAgIHJldCA9IChyZXQgJSBNT0QgKyBzb2x2ZShyZW0gLSBpLCBjdXIgKyAxLCBpKSAlIE1PRCkgJSBNT0Q7CiAgICByZXR1cm4gcmV0Owp9CgppbnQgbWFpbigpewojaWZuZGVmIE9OTElORV9KVURHRQoJZnJlb3BlbigiaW4udHh0IiwgInIiLCBzdGRpbik7CiNlbmRpZgogICAgd2hpbGUoc2NzYyhuLCBrKSAhPSBFT0YpewogICAgICAgIGlmKCFuICYmICFrKQogICAgICAgICAgICBicmVhazsKICAgICAgICBtcyhkcCwgLTEpOwogICAgICAgIHByaW50ZigiJWxsZFxuIiwgc29sdmUobiwgMCwgMSkpOwogICAgfQoJcmV0dXJuIDA7Cn0K