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;
mt19937 genrand(chrono::system_clock::now().time_since_epoch().count());
string inttostr(long long str) {
  stringstream stream;
  stream << str;
  return stream.str();
}
string numtobin(long long n) {
  string r = "";
  while (n) r = ((n & 1) ? '1' : '0') + r, n >>= 1;
  return r;
}
long long bintonum(string s) {
  long long n = 0, p = 1 << (s.length() - 1);
  for (char i : s) n += (i - '0') * p, p >>= 1;
  return n;
}
long long modexpo(long long a, long long b, long long n) {
  long long d = 1;
  while (b) {
    if (b & 1) d = (d * a) % n;
    b >>= 1;
    a = (a * a) % n;
  }
  return d;
}
long long expo(long long a, long long b) {
  long long d = 1;
  while (b) {
    if (b & 1) d = d * a;
    b >>= 1;
    a = a * a;
  }
  return d;
}
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long inv(long long a, long long m) { return modexpo(a, m - 2, m); }
void take_input_and_output_from_file() {}
inline long long scan_int() {
  long long NR = 0, sign = 1;
  char c = getchar();
  while (c < 48 || c > 57) {
    if (c == '-') sign = 0;
    c = getchar();
  }
  while (c > 47 && c < 58) {
    NR = (NR << 3) + (NR << 1) + (c - 48);
    c = getchar();
  }
  return (sign ? NR : (-NR));
}
long long d, s;
vector<string> v;
queue<pair<long long, long long> > Q;
int sumTrace[5555][5555], mulTrace[5555][5555];
void print(int sum, int mul) {
  if (sumTrace[sum][mul] == 42) return;
  print(sum - sumTrace[sum][mul], mulTrace[sum][mul]);
  printf("%d", sumTrace[sum][mul]);
}
void solve() {
  Q.push({0, 0});
  long long k = 0;
  long long f = 0;
  sumTrace[0][0] = 42;
  while (1) {
    int sum = Q.front().first;
    int mul = Q.front().second;
    if (sum == s && mul == 0) {
      f = 1;
      break;
    }
    Q.pop();
    for (int i = 0; i < 10; i++) {
      int nsum = sum + i;
      if (nsum > s) break;
      int nmul = (mul * 10 + i) % d;
      if (nsum < 0 || nmul < 0 || nsum > 5555 || nmul > 5555) break;
      if (sumTrace[nsum][nmul] == -1) {
        Q.push({nsum, nmul});
        sumTrace[nsum][nmul] = i;
        mulTrace[nsum][nmul] = mul;
      }
    }
    if (Q.size() > 10000000) break;
  }
  if (!f)
    cout << -1 << endl;
  else
    print(s, 0);
  cout << endl;
}
int main() {
  d = scan_int();
  s = scan_int();
  long long i;
  memset(sumTrace, -1, sizeof sumTrace);
  solve();
  return 0;
}