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>
template <typename Y>
inline bool updmin(Y &a, Y b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename Y>
inline bool updmax(Y &a, Y b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename Y>
inline Y abs(Y a) {
  if (a < 0) a = -a;
  return a;
}
template <typename Y>
inline Y sqr(Y a) {
  return a * a;
}
int read() {
  int w = 1, q = 0, ch = ' ';
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') w = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) q = q * 10 + ch - 48;
  return q * w;
}
inline void FileIO() {
  freopen(
      ""
      ".in",
      "r", stdin);
  freopen(
      ""
      ".out",
      "w", stdout);
}
int d, s;
int len[5050][505];
std::pair<int, int> pre[5050][505];
std::queue<std::pair<int, int> > q;
int main() {
  d = read();
  s = read();
  for (int i = 1; i <= 9; i++) {
    len[i][i % d] = 1;
    q.push(std::make_pair(i, i % d));
  }
  while (!q.empty()) {
    std::pair<int, int> x = q.front();
    q.pop();
    for (int i = 0; i <= 9; i++) {
      if (x.first + i <= s && !len[x.first + i][(x.second * 10 + i) % d]) {
        len[x.first + i][(x.second * 10 + i) % d] = len[x.first][x.second] + 1;
        pre[x.first + i][(x.second * 10 + i) % d] = x;
        q.push(std::make_pair(x.first + i, (x.second * 10 + i) % d));
      }
    }
  }
  if (!len[s][0]) {
    puts("-1");
    return 0;
  }
  std::string ans;
  int x = s, y = 0;
  while (1) {
    if (len[x][y] == 1) {
      ans = (char)(48 + x) + ans;
      break;
    }
    std::pair<int, int> tmp = pre[x][y];
    ans = (char)(48 + x - tmp.first) + ans;
    x = tmp.first, y = tmp.second;
  }
  std::cout << ans << std::endl;
  return 0;
}