#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mp make_pair
#define mod 666013
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second 
#define pll pair<ll,ll>
#define afor(i,a,b) for(int i=a;i<b;++i)
#define bfor(i,a,b) for(int i=a;i>=b;--i)
#define print(A,j,k) for(int ii=j;ii<k;ii++)cout<<A[ii]<<" ";cout<<"\n"
#define all(v) v.begin(),v.end()
#define ps cout<<"YES\n";
#define PI 3.14159265358979323846264338
#define CASES int t;cin>>t;while(t--)
//ans = a ? b : c; // to simplify: if (a) ans = b; else ans = c;
//if(x&1)-->odd else even.
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
using namespace std;
ll fact[1000000];
ll modpow(ll base, ll exp, ll modulus) {
  base %= modulus;
  ll result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
ll modinverse(ll a)
{
    return modpow(a,mod-2,mod);
}
void solve()
{
    fact[0]=1;
    afor(i,1,200001)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll C(ll a,ll b)
{
    ll z=fact[a]*(modinverse(fact[b])%mod*modinverse(fact[a-b])%mod)%mod;
    return z%mod;
}
ll dear(ll n)
{
    ll ans=0;
    afor(i,2,n+1)
    {
        if(i%2==0)
            ans+=(fact[n]/fact[i]);
        else
            ans-=(fact[n]/fact[i]);
        //cout<<fact[n]<<" "<<fact[i]<<" "<<ans<<"\n";
    }
    return ans;
}
int main()
{
    fast
    solve();
    ll n,m;
    cin>>n>>m;
    ll z=C(n-1,m-1);
    ll x=dear(m);
    cout<<(z*x)%mod<<"\n";
    return 0;
}