Problem: You are given two positive integers d and s. Find minimal positive integer n which is divisible by d and has sum of digits equal to s.

Input

The first line contains two positive integers d and s (1 ≤ d ≤ 500, 1 ≤ s ≤ 5000) separated by space.

Output

Print the required number or -1 if it doesn't exist.

Examples

Input

13 50


Output

699998


Input

61 2


Output

1000000000000000000000000000001


Input

15 50


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long INF = 1 << 28;
const double pi = acos(-1.0);
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, 1, -1};
int dir[4][2] = {1, 0, -1, 0, 0, -1, 0, 1};
const long double EPS = 1e-7;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
bool cmp(int a, int b) { return a < b; }
struct compare {
  bool operator()(const int& l, const int& r) { return l > r; }
};
bool cmp1(int a, int b) { return a > b; }
int vis[6000][600];
pair<int, int> dp[6000][600];
int s, d;
int bfs() {
  queue<pair<int, int> > q;
  q.push(make_pair(s, 0));
  vis[s][0] = 1;
  pair<int, int> p;
  int f = 1, mul, sum;
  while (!q.empty()) {
    p = q.front();
    q.pop();
    for (int i = f; i < 10; i++) {
      sum = p.first;
      sum -= i;
      mul = p.second;
      mul *= 10;
      mul += i;
      mul %= d;
      if (sum == 0 && mul == 0) {
        dp[sum][mul] = make_pair(p.first, p.second);
        return 1;
      }
      if (sum >= 0 && !vis[sum][mul]) {
        vis[sum][mul] = 1;
        q.push(make_pair(sum, mul));
        dp[sum][mul] = make_pair(p.first, p.second);
      }
    }
    f = 0;
  }
  return 0;
}
void print(int sum, int mul) {
  if (sum == s && mul == 0) return;
  print(dp[sum][mul].first, dp[sum][mul].second);
  cout << dp[sum][mul].first - sum;
}
int main() {
  scanf("%d %d", &d, &s);
  if (bfs() == 1) {
    print(0, 0);
  } else
    cout << -1 << endl;
  return 0;
}