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;
string sol;
int d, s;
vector<vector<bool> > used;
const string ROP = "-2";
bool comp(string& a, string& b) {
  if (b == ROP) return true;
  if (a == ROP) return false;
  if (a.size() != b.size()) return a.size() < b.size();
  for (int i = 0; i < a.size(); ++i) {
    if (a[i] != b[i]) return a[i] < b[i];
  }
  return false;
}
void bfs() {
  queue<pair<string, pair<int, int> > > q;
  for (int i = 0; i < 10 and i <= s; ++i) {
    string aa;
    aa.push_back(i + '0');
    q.push(make_pair(aa, make_pair(i % d, i)));
    used[i % d][i] = true;
    if (i % d == 0 and i == s) {
      sol = "";
      sol.push_back(i + '0');
    }
  }
  while (not q.empty()) {
    pair<string, pair<int, int> > P = q.front();
    q.pop();
    string t = P.first;
    pair<int, int> P1 = P.second;
    if (comp(t, sol)) {
      for (int i = 0; i < 10; ++i) {
        if (P1.second + i <= s) {
          int dd = (10 * P1.first + i) % d;
          if (not used[dd][P1.second + i]) {
            if (dd == 0 and P1.second + i == s) {
              string tt;
              for (int i = 0; i < t.size(); ++i) {
                tt.push_back(t[i]);
              }
              tt.push_back(i + '0');
              if (comp(tt, sol)) sol = tt;
            } else {
              string tt;
              for (int i = 0; i < t.size(); ++i) {
                tt.push_back(t[i]);
              }
              tt.push_back(i + '0');
              used[dd][P1.second + i] = true;
              q.push(make_pair(tt, make_pair(dd, P1.second + i)));
            }
          }
        }
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> d >> s;
  sol = ROP;
  used = vector<vector<bool> >(d, vector<bool>(s + 1, false));
  bfs();
  if (sol == ROP)
    cout << "-1" << endl;
  else
    cout << sol << endl;
}