#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define task "COREWARD"
using namespace std;
const int N = 1e3, mod = 123456789;

int m, n;
ll dp[N + 5][N + 5];

void add(ll &x, const ll &y)
{
    (x += y) %= mod;
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    if(fopen(task".INP", "r"))
    {
        freopen(task".INP", "r", stdin);
        freopen(task".OUT", "w", stdout);
    }

    cin >> m >> n;

    dp[0][0] = 1;
    for(int i = 1; i <= n; ++i)
        for(int j = 0; j <= m; ++j)
        {
            add(dp[i][j], dp[i - 1][j]);
            if(j >= i)
                add(dp[i][j], dp[i][j - i]);
        }

    cout << dp[n][m] << endl;
    return 0;
}
