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;
void solve();
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec" << endl;
}
int d, s;
int dist[505][5005];
pair<int, int> path[505][5005];
int INF = 1 << 30;
void bfs() {
  queue<pair<int, int> > q;
  for (int i = 0; i < 505; i++) {
    for (int j = 0; j < 5005; j++) {
      dist[i][j] = INF;
    }
  }
  dist[0][0] = 0;
  q.push({0, 0});
  while (!q.empty()) {
    int currMod = q.front().first;
    int currSum = q.front().second;
    q.pop();
    for (int i = 0; i < 10; i++) {
      int nxtSum = currSum + i;
      int nxtMod = (currMod * 10 + i) % d;
      if (nxtSum > s) break;
      if (dist[nxtMod][nxtSum] == INF) {
        dist[nxtMod][nxtSum] = dist[currMod][currSum] + 1;
        path[nxtMod][nxtSum] = {currMod, currSum};
        q.push({nxtMod, nxtSum});
      }
    }
  }
}
int p[5000];
void solve() {
  int ch;
  cin >> d >> s;
  ch = d;
  bfs();
  p[0] = 1;
  for (int i = 1; i < 5000; i++) {
    p[i] = (p[i - 1] * 10) % d;
  }
  d = 0;
  if (dist[d][s] == INF) {
    cout << -1;
    return;
  }
  vector<int> ans;
  while (s != 0) {
    int nxtMod = path[d][s].first;
    int nxtSum = path[d][s].second;
    ans.push_back(s - nxtSum);
    d = nxtMod;
    s = nxtSum;
  }
  reverse(ans.begin(), ans.end());
  for (int x : ans) {
    cout << x;
  }
}