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
#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &x) {
  x = 0;
  char c = 0;
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
}
template <class T>
void write(T x) {
  if (x > 9) write(x / 10);
  putchar(48 + x % 10);
}
int d, s, dist[500][5001], vis[500][5001], qx[5000001], qy[5000001], cl;
string ans[10], res;
void solve(int st, int x, int y) {
  if (x == 0 && y == s) return;
  for (int i = 0; i <= 9; i++) {
    int tx = (x * 10 + i) % d;
    int ty = y + i;
    if (ty > s) continue;
    if (dist[tx][ty] == dist[x][y] + 1 && vis[tx][ty]) {
      ans[st] = ans[st] + (char)(48 + i);
      solve(st, tx, ty);
      break;
    }
  }
}
void bfs(int st) {
  memset(vis, 0, sizeof(vis));
  memset(dist, -1, sizeof(dist));
  cl = 1;
  qx[0] = st % d;
  qy[0] = st;
  dist[qx[0]][qy[0]] = 1;
  for (int i = 0; i <= cl - 1; i++) {
    int x = qx[i], y = qy[i];
    for (int j = 0; j <= 9; j++) {
      int tx = (x * 10 + j) % d;
      int ty = y + j;
      if (ty > s) continue;
      if (dist[tx][ty] == -1) {
        dist[tx][ty] = dist[x][y] + 1;
        qx[cl] = tx;
        qy[cl++] = ty;
      }
    }
  }
  if (dist[0][s] == -1) return;
  int k;
  for (int i = cl - 1; i >= 0; i--)
    if (qx[i] == 0 && qy[i] == s) {
      vis[0][s] = 1;
      k = i;
      break;
    }
  for (int i = k - 1; i >= 0; i--) {
    int x = qx[i], y = qy[i];
    for (int j = 0; j <= 9; j++) {
      int tx = (x * 10 + j) % d;
      int ty = y + j;
      if (ty > s) continue;
      if (vis[tx][ty] && dist[x][y] + 1 == dist[tx][ty]) {
        vis[x][y] = 1;
        break;
      }
    }
  }
  ans[st] = (char)(48 + st);
  solve(st, qx[0], qy[0]);
}
int main() {
  read(d);
  read(s);
  for (int i = 1; i <= 9; i++) {
    bfs(i);
    if (ans[i].size() == 0) continue;
    if (res.size() == 0 || (res.size() > ans[i].size() ||
                            res.size() == ans[i].size() && res > ans[i]))
      res = ans[i];
  }
  if (res.size() == 0)
    cout << -1 << endl;
  else
    cout << res << endl;
  return 0;
}
