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;
const int MAXD = 500;
const int MAXS = 5000;
bool vis[MAXD][MAXS + 1];
int dig[MAXD][MAXS + 1], from[MAXD][MAXS + 1];
struct Data {
  int last, c, prev_r;
  int r, sum;
  bool operator<(const Data &other) const { return last < other.last; }
};
queue<Data> mst;
int main() {
  int d, s;
  ios::sync_with_stdio(false);
  cin >> d >> s;
  mst.push({0, 0, 0, 0, 0});
  int last = 0;
  while (!mst.empty()) {
    auto it = mst.front();
    int r = it.r, sum = it.sum;
    int prev_r = it.prev_r, c = it.c;
    mst.pop();
    if (vis[r][sum]) {
      continue;
    }
    vis[r][sum] = 1;
    dig[r][sum] = c;
    from[r][sum] = prev_r;
    for (c = 0; c < 10; c++) {
      int cur = (r * 10 + c) % d;
      if (sum + c <= s && vis[cur][sum + c] == 0) {
        mst.push({++last, c, r, cur, sum + c});
      }
    }
  }
  if (vis[0][s]) {
    vector<int> sol;
    int r = 0;
    while (s > 0) {
      int cur = dig[r][s];
      sol.push_back(cur);
      r = from[r][s];
      s -= cur;
    }
    reverse(sol.begin(), sol.end());
    for (auto it : sol) {
      cout << it;
    }
    return 0;
  }
  cout << -1;
  return 0;
}